chrome: Add SetAccessibilityState support (fixes #3649)
This commit is contained in:
parent
f09a9bc0b1
commit
8b7af53124
|
@ -368,20 +368,6 @@ bool AlloyBrowserHostImpl::HasDevTools() {
|
|||
return devtools_manager_->HasDevTools();
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SetAccessibilityState(
|
||||
cef_state_t accessibility_state) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&AlloyBrowserHostImpl::SetAccessibilityState,
|
||||
this, accessibility_state));
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->SetAccessibilityState(accessibility_state);
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) {
|
||||
|
|
|
@ -117,7 +117,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
|||
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
|
||||
void SetAudioMuted(bool mute) override;
|
||||
bool IsAudioMuted() override;
|
||||
void SetAccessibilityState(cef_state_t accessibility_state) override;
|
||||
void SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) override;
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "components/permissions/permission_request_manager.h"
|
||||
#include "components/zoom/zoom_controller.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "extensions/browser/process_manager.h"
|
||||
#include "pdf/pdf_features.h"
|
||||
|
@ -313,31 +312,6 @@ void CefBrowserPlatformDelegateAlloy::ConfigureAutoResize() {
|
|||
}
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateAlloy::SetAccessibilityState(
|
||||
cef_state_t accessibility_state) {
|
||||
// Do nothing if state is set to default. It'll be disabled by default and
|
||||
// controlled by the commmand-line flags "force-renderer-accessibility" and
|
||||
// "disable-renderer-accessibility".
|
||||
if (accessibility_state == STATE_DEFAULT) {
|
||||
return;
|
||||
}
|
||||
|
||||
content::WebContentsImpl* web_contents_impl =
|
||||
static_cast<content::WebContentsImpl*>(web_contents_);
|
||||
|
||||
if (!web_contents_impl) {
|
||||
return;
|
||||
}
|
||||
|
||||
ui::AXMode accMode;
|
||||
// In windowless mode set accessibility to TreeOnly mode. Else native
|
||||
// accessibility APIs, specific to each platform, are also created.
|
||||
if (accessibility_state == STATE_ENABLED) {
|
||||
accMode = IsWindowless() ? ui::kAXModeWebContentsOnly : ui::kAXModeComplete;
|
||||
}
|
||||
web_contents_impl->SetAccessibilityMode(accMode);
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateAlloy::IsPrintPreviewSupported() const {
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
|
|||
void SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) override;
|
||||
void SetAccessibilityState(cef_state_t accessibility_state) override;
|
||||
bool IsPrintPreviewSupported() const override;
|
||||
void Find(const CefString& searchText,
|
||||
bool forward,
|
||||
|
|
|
@ -1009,6 +1009,20 @@ void CefBrowserHostBase::GetFrameNames(std::vector<CefString>& names) {
|
|||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::SetAccessibilityState(
|
||||
cef_state_t accessibility_state) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostBase::SetAccessibilityState,
|
||||
this, accessibility_state));
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->SetAccessibilityState(accessibility_state);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::OnStateChanged(CefBrowserContentsState state_changed) {
|
||||
// Make sure that CefBrowser state is consistent before the associated
|
||||
// CefClient callback is executed.
|
||||
|
|
|
@ -262,6 +262,7 @@ class CefBrowserHostBase : public CefBrowserHost,
|
|||
size_t GetFrameCount() override;
|
||||
void GetFrameIdentifiers(std::vector<CefString>& identifiers) override;
|
||||
void GetFrameNames(std::vector<CefString>& names) override;
|
||||
void SetAccessibilityState(cef_state_t accessibility_state) override;
|
||||
|
||||
// CefBrowserContentsDelegate::Observer methods:
|
||||
void OnStateChanged(CefBrowserContentsState state_changed) override;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "base/logging.h"
|
||||
#include "chrome/browser/platform_util.h"
|
||||
#include "chrome/browser/shell_integration.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
|
@ -409,7 +410,27 @@ void CefBrowserPlatformDelegate::SetAutoResizeEnabled(bool enabled,
|
|||
|
||||
void CefBrowserPlatformDelegate::SetAccessibilityState(
|
||||
cef_state_t accessibility_state) {
|
||||
NOTIMPLEMENTED();
|
||||
// Do nothing if state is set to default. It'll be disabled by default and
|
||||
// controlled by the command-line flags "force-renderer-accessibility" and
|
||||
// "disable-renderer-accessibility".
|
||||
if (accessibility_state == STATE_DEFAULT) {
|
||||
return;
|
||||
}
|
||||
|
||||
content::WebContentsImpl* web_contents_impl =
|
||||
static_cast<content::WebContentsImpl*>(web_contents_);
|
||||
|
||||
if (!web_contents_impl) {
|
||||
return;
|
||||
}
|
||||
|
||||
ui::AXMode accMode;
|
||||
// In windowless mode set accessibility to TreeOnly mode. Else native
|
||||
// accessibility APIs, specific to each platform, are also created.
|
||||
if (accessibility_state == STATE_ENABLED) {
|
||||
accMode = IsWindowless() ? ui::kAXModeWebContentsOnly : ui::kAXModeComplete;
|
||||
}
|
||||
web_contents_impl->SetAccessibilityMode(accMode);
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegate::IsPrintPreviewSupported() const {
|
||||
|
|
|
@ -369,11 +369,6 @@ bool ChromeBrowserHostImpl::IsAudioMuted() {
|
|||
return false;
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::SetAccessibilityState(
|
||||
cef_state_t accessibility_state) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) {
|
||||
|
|
|
@ -104,7 +104,6 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
|||
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
|
||||
void SetAudioMuted(bool mute) override;
|
||||
bool IsAudioMuted() override;
|
||||
void SetAccessibilityState(cef_state_t accessibility_state) override;
|
||||
void SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) override;
|
||||
|
|
Loading…
Reference in New Issue