Commit 816f700d authored by Nishant Kaushik's avatar Nishant Kaushik Committed by Marshall Greenblatt

Implement accessibility enhancements (issue #1217)

- Add new CefBrowserHost::SetAccessibilityState method for toggling
  accessibility state when readers are detected by the client.
- Add new CefAccessibilityHandler interface for the delivery of
  accessibility notifications to windowless (OSR) clients.
- Fix delivery of CefFocusHandler callbacks to windowless clients.
- cefclient: Add example windowless accessibility implementation on Windows and macOS.
- cefclient: Automatically detect screen readers on Windows and macOS.
parent 64fcfa60
......@@ -380,6 +380,8 @@ static_library("libcef_static") {
"libcef/browser/origin_whitelist_impl.h",
"libcef/browser/osr/browser_platform_delegate_osr.cc",
"libcef/browser/osr/browser_platform_delegate_osr.h",
"libcef/browser/osr/osr_accessibility_util.cc",
"libcef/browser/osr/osr_accessibility_util.h",
"libcef/browser/osr/osr_util.cc",
"libcef/browser/osr/osr_util.h",
"libcef/browser/osr/render_widget_host_view_osr.cc",
......@@ -1738,11 +1740,12 @@ if (is_mac) {
libs = [
"comctl32.lib",
"shlwapi.lib",
"rpcrt4.lib",
"opengl32.lib",
"glu32.lib",
"imm32.lib",
"oleacc.lib",
"opengl32.lib",
"rpcrt4.lib",
"shlwapi.lib",
]
}
......
......@@ -12,6 +12,7 @@
{
'variables': {
'autogen_cpp_includes': [
'include/cef_accessibility_handler.h',
'include/cef_app.h',
'include/cef_auth_callback.h',
'include/cef_browser.h',
......@@ -100,6 +101,7 @@
'include/views/cef_window_delegate.h',
],
'autogen_capi_includes': [
'include/capi/cef_accessibility_handler_capi.h',
'include/capi/cef_app_capi.h',
'include/capi/cef_auth_callback_capi.h',
'include/capi/cef_browser_capi.h',
......@@ -188,6 +190,8 @@
'include/capi/views/cef_window_delegate_capi.h',
],
'autogen_library_side': [
'libcef_dll/ctocpp/accessibility_handler_ctocpp.cc',
'libcef_dll/ctocpp/accessibility_handler_ctocpp.h',
'libcef_dll/ctocpp/app_ctocpp.cc',
'libcef_dll/ctocpp/app_ctocpp.h',
'libcef_dll/cpptoc/auth_callback_cpptoc.cc',
......@@ -460,6 +464,8 @@
'libcef_dll/cpptoc/zip_reader_cpptoc.h',
],
'autogen_client_side': [
'libcef_dll/cpptoc/accessibility_handler_cpptoc.cc',
'libcef_dll/cpptoc/accessibility_handler_cpptoc.h',
'libcef_dll/cpptoc/app_cpptoc.cc',
'libcef_dll/cpptoc/app_cpptoc.h',
'libcef_dll/ctocpp/auth_callback_ctocpp.cc',
......
......@@ -286,6 +286,11 @@
'tests/cefclient/browser/main_context_impl_win.cc',
'tests/cefclient/browser/main_message_loop_multithreaded_win.cc',
'tests/cefclient/browser/main_message_loop_multithreaded_win.h',
'tests/cefclient/browser/osr_accessibility_helper.cc',
'tests/cefclient/browser/osr_accessibility_helper.h',
'tests/cefclient/browser/osr_accessibility_node.cc',
'tests/cefclient/browser/osr_accessibility_node.h',
'tests/cefclient/browser/osr_accessibility_node_win.cc',
'tests/cefclient/browser/osr_dragdrop_win.cc',
'tests/cefclient/browser/osr_dragdrop_win.h',
'tests/cefclient/browser/osr_ime_handler_win.cc',
......@@ -321,6 +326,11 @@
'tests/cefclient/browser/browser_window_std_mac.h',
'tests/cefclient/browser/browser_window_std_mac.mm',
'tests/cefclient/browser/main_context_impl_posix.cc',
'tests/cefclient/browser/osr_accessibility_helper.cc',
'tests/cefclient/browser/osr_accessibility_helper.h',
'tests/cefclient/browser/osr_accessibility_node.cc',
'tests/cefclient/browser/osr_accessibility_node.h',
'tests/cefclient/browser/osr_accessibility_node_mac.mm',
'tests/cefclient/browser/root_window_mac.h',
'tests/cefclient/browser/root_window_mac.mm',
'tests/cefclient/browser/temp_window_mac.h',
......@@ -399,6 +409,7 @@
'tests/cefsimple/simple_handler_linux.cc',
],
'ceftests_sources_common': [
'tests/ceftests/accessibility_unittest.cc',
'tests/ceftests/browser_info_map_unittest.cc',
'tests/ceftests/command_line_unittest.cc',
'tests/ceftests/cookie_unittest.cc',
......
// Copyright (c) 2017 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef CEF_INCLUDE_CAPI_CEF_ACCESSIBILITY_HANDLER_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_ACCESSIBILITY_HANDLER_CAPI_H_
#pragma once
#include "include/capi/cef_values_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Implement this structure to receive accessibility notification when
// accessibility events have been registered. The functions of this structure
// will be called on the UI thread.
///
typedef struct _cef_accessibility_handler_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Called after renderer process sends accessibility tree changes to the
// browser process.
///
void (CEF_CALLBACK *on_accessibility_tree_change)(
struct _cef_accessibility_handler_t* self, struct _cef_value_t* value);
///
// Called after renderer process sends accessibility location changes to the
// browser process.
///
void (CEF_CALLBACK *on_accessibility_location_change)(
struct _cef_accessibility_handler_t* self, struct _cef_value_t* value);
} cef_accessibility_handler_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_ACCESSIBILITY_HANDLER_CAPI_H_
......@@ -748,6 +748,34 @@ typedef struct _cef_browser_host_t {
///
struct _cef_navigation_entry_t* (CEF_CALLBACK *get_visible_navigation_entry)(
struct _cef_browser_host_t* self);
///
// Set accessibility state for all frames. |accessibility_state| may be
// default, enabled or disabled. If |accessibility_state| is STATE_DEFAULT
// then accessibility will be disabled by default and the state may be further
// controlled with the "force-renderer-accessibility" and "disable-renderer-
// accessibility" command-line switches. If |accessibility_state| is
// STATE_ENABLED then accessibility will be enabled. If |accessibility_state|
// is STATE_DISABLED then accessibility will be completely disabled.
//
// For windowed browsers accessibility will be enabled in Complete mode (which
// corresponds to kAccessibilityModeComplete in Chromium). In this mode all
// platform accessibility objects will be created and managed by Chromium's
// internal implementation. The client needs only to detect the screen reader
// and call this function appropriately. For example, on macOS the client can
// handle the @"AXEnhancedUserStructure" accessibility attribute to detect
// VoiceOver state changes and on Windows the client can handle WM_GETOBJECT
// with OBJID_CLIENT to detect accessibility readers.
//
// For windowless browsers accessibility will be enabled in TreeOnly mode
// (which corresponds to kAccessibilityModeWebContentsOnly in Chromium). In
// this mode renderer accessibility is enabled, the full tree is computed, and
// events are passed to CefAccessibiltyHandler, but platform accessibility
// objects are not created. The client may implement platform accessibility
// objects using CefAccessibiltyHandler callbacks if desired.
///
void (CEF_CALLBACK *set_accessibility_state)(struct _cef_browser_host_t* self,
cef_state_t accessibility_state);
} cef_browser_host_t;
......
......@@ -38,6 +38,7 @@
#define CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
#pragma once
#include "include/capi/cef_accessibility_handler_capi.h"
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_browser_capi.h"
#include "include/capi/cef_drag_data_capi.h"
......@@ -57,6 +58,14 @@ typedef struct _cef_render_handler_t {
///
cef_base_ref_counted_t base;
///
// Return the handler for accessibility notifications. If no handler is
// provided the default implementation will be used.
///
struct _cef_accessibility_handler_t* (
CEF_CALLBACK *get_accessibility_handler)(
struct _cef_render_handler_t* self);
///
// Called to retrieve the root window rectangle in screen coordinates. Return
// true (1) if the rectangle was provided.
......
// Copyright (c) 2017 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_ACCESSIBILITY_HANDLER_H_
#define CEF_INCLUDE_CEF_ACCESSIBILITY_HANDLER_H_
#pragma once
#include "include/cef_values.h"
///
// Implement this interface to receive accessibility notification when
// accessibility events have been registered. The methods of this class will
// be called on the UI thread.
///
/*--cef(source=client)--*/
class CefAccessibilityHandler : public virtual CefBaseRefCounted {
public:
///
// Called after renderer process sends accessibility tree changes to the
// browser process.
///
/*--cef()--*/
virtual void OnAccessibilityTreeChange(CefRefPtr<CefValue> value) =0;
///
// Called after renderer process sends accessibility location changes to the
// browser process.
///
/*--cef()--*/
virtual void OnAccessibilityLocationChange(CefRefPtr<CefValue> value) =0;
};
#endif // CEF_INCLUDE_CEF_ACCESSIBILITY_HANDLER_H_
......@@ -365,7 +365,7 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
// Retrieve the window handle of the browser that opened this browser. Will
// return NULL for non-popup windows or if this browser is wrapped in a
// CefBrowserView. This method can be used in combination with custom handling
// of modal windows.
// of modal windows.
///
/*--cef()--*/
virtual CefWindowHandle GetOpenerWindowHandle() =0;
......@@ -805,6 +805,35 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
///
/*--cef()--*/
virtual CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() =0;
///
// Set accessibility state for all frames. |accessibility_state| may be
// default, enabled or disabled. If |accessibility_state| is STATE_DEFAULT
// then accessibility will be disabled by default and the state may be further
// controlled with the "force-renderer-accessibility" and
// "disable-renderer-accessibility" command-line switches. If
// |accessibility_state| is STATE_ENABLED then accessibility will be enabled.
// If |accessibility_state| is STATE_DISABLED then accessibility will be
// completely disabled.
//
// For windowed browsers accessibility will be enabled in Complete mode (which
// corresponds to kAccessibilityModeComplete in Chromium). In this mode all
// platform accessibility objects will be created and managed by Chromium's
// internal implementation. The client needs only to detect the screen reader
// and call this method appropriately. For example, on macOS the client can
// handle the @"AXEnhancedUserInterface" accessibility attribute to detect
// VoiceOver state changes and on Windows the client can handle WM_GETOBJECT
// with OBJID_CLIENT to detect accessibility readers.
//
// For windowless browsers accessibility will be enabled in TreeOnly mode
// (which corresponds to kAccessibilityModeWebContentsOnly in Chromium). In
// this mode renderer accessibility is enabled, the full tree is computed, and
// events are passed to CefAccessibiltyHandler, but platform accessibility
// objects are not created. The client may implement platform accessibility
// objects using CefAccessibiltyHandler callbacks if desired.
///
/*--cef()--*/
virtual void SetAccessibilityState(cef_state_t accessibility_state) =0;
};
#endif // CEF_INCLUDE_CEF_BROWSER_H_
......@@ -40,6 +40,7 @@
#include <vector>
#include "include/cef_accessibility_handler.h"
#include "include/cef_base.h"
#include "include/cef_browser.h"
#include "include/cef_drag_data.h"
......@@ -57,6 +58,15 @@ class CefRenderHandler : public virtual CefBaseRefCounted {
typedef cef_paint_element_type_t PaintElementType;
typedef std::vector<CefRect> RectList;
///
// Return the handler for accessibility notifications. If no handler is
// provided the default implementation will be used.
///
/*--cef()--*/
virtual CefRefPtr<CefAccessibilityHandler> GetAccessibilityHandler() {
return NULL;
}
///
// Called to retrieve the root window rectangle in screen coordinates. Return
// true if the rectangle was provided.
......
......@@ -46,6 +46,7 @@
#include "components/zoom/zoom_controller.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/view_messages.h"
#include "content/public/browser/desktop_media_id.h"
#include "content/public/browser/download_manager.h"
......@@ -930,6 +931,39 @@ CefRefPtr<CefNavigationEntry> CefBrowserHostImpl::GetVisibleNavigationEntry() {
return new CefNavigationEntryImpl(entry);
}
void CefBrowserHostImpl::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;
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::SetAccessibilityState,
this, accessibility_state));
return;
}
content::WebContentsImpl* web_contents_impl =
static_cast<content::WebContentsImpl*>(web_contents());
if (!web_contents_impl)
return;
content::AccessibilityMode 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) {
if (IsWindowless())
accMode = content::kAccessibilityModeWebContentsOnly;
else
accMode = content::kAccessibilityModeComplete;
}
web_contents_impl->SetAccessibilityMode(accMode);
}
void CefBrowserHostImpl::SetMouseCursorChangeDisabled(bool disabled) {
base::AutoLock lock_scope(state_lock_);
mouse_cursor_change_disabled_ = disabled;
......@@ -2690,6 +2724,28 @@ bool CefBrowserHostImpl::OnMessageReceived(const IPC::Message& message) {
return handled;
}
void CefBrowserHostImpl::AccessibilityEventReceived(
const std::vector<content::AXEventNotificationDetails>& eventData) {
// Only needed in windowless mode.
if (IsWindowless()) {
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->AccessibilityEventReceived(eventData);
}
}
void CefBrowserHostImpl::AccessibilityLocationChangesReceived(
const std::vector<content::AXLocationChangeNotificationDetails>& locData) {
// Only needed in windowless mode.
if (IsWindowless()) {
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->AccessibilityLocationChangesReceived(locData);
}
}
void CefBrowserHostImpl::OnWebContentsFocused() {
if (client_.get()) {
CefRefPtr<CefFocusHandler> handler = client_->GetFocusHandler();
......
......@@ -229,6 +229,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
void DragSourceSystemDragEnded() override;
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
void SetAccessibilityState(cef_state_t accessibility_state) override;
// CefBrowser methods.
CefRefPtr<CefBrowserHost> GetHost() override;
......@@ -471,6 +472,13 @@ class CefBrowserHostImpl : public CefBrowserHost,
void DidUpdateFaviconURL(
const std::vector<content::FaviconURL>& candidates) override;
bool OnMessageReceived(const IPC::Message& message) override;
void AccessibilityEventReceived(
const std::vector<content::AXEventNotificationDetails>& eventData)
override;
void AccessibilityLocationChangesReceived(
const std::vector<content::AXLocationChangeNotificationDetails>& locData)
override;
void OnWebContentsFocused() override;
// Override to provide a thread safe implementation.
bool Send(IPC::Message* message) override;
......
......@@ -202,6 +202,16 @@ void CefBrowserPlatformDelegate::DragSourceSystemDragEnded() {
NOTREACHED();
}
void CefBrowserPlatformDelegate::AccessibilityEventReceived(
const std::vector<content::AXEventNotificationDetails>& eventData) {
NOTREACHED();
}
void CefBrowserPlatformDelegate::AccessibilityLocationChangesReceived(
const std::vector<content::AXLocationChangeNotificationDetails>& locData) {
NOTREACHED();
}
// static
int CefBrowserPlatformDelegate::TranslateModifiers(uint32 cef_modifiers) {
int webkit_modifiers = 0;
......
......@@ -262,6 +262,10 @@ class CefBrowserPlatformDelegate {
virtual void DragSourceEndedAt(int x, int y,
cef_drag_operations_mask_t op);
virtual void DragSourceSystemDragEnded();
virtual void AccessibilityEventReceived(
const std::vector<content::AXEventNotificationDetails>& eventData);
virtual void AccessibilityLocationChangesReceived(
const std::vector<content::AXLocationChangeNotificationDetails>& locData);
protected:
// Allow deletion via scoped_ptr only.
......
......@@ -8,6 +8,7 @@
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/image_impl.h"
#include "libcef/browser/osr/osr_accessibility_util.h"
#include "libcef/browser/osr/render_widget_host_view_osr.h"
#include "libcef/browser/osr/web_contents_view_osr.h"
#include "libcef/common/drag_data_impl.h"
......@@ -522,6 +523,34 @@ void CefBrowserPlatformDelegateOsr::DragSourceSystemDragEnded() {
drag_start_rwh_ = nullptr;
}
void CefBrowserPlatformDelegateOsr::AccessibilityEventReceived(
const std::vector<content::AXEventNotificationDetails>& eventData) {
CefRefPtr<CefRenderHandler> handler = browser_->client()->GetRenderHandler();
if (handler.get()) {
CefRefPtr<CefAccessibilityHandler> acchandler =
handler->GetAccessibilityHandler();
if (acchandler.get()) {
acchandler->OnAccessibilityTreeChange(
osr_accessibility_util::ParseAccessibilityEventData(eventData));
}
}
}
void CefBrowserPlatformDelegateOsr::AccessibilityLocationChangesReceived(
const std::vector<content::AXLocationChangeNotificationDetails>& locData) {
CefRefPtr<CefRenderHandler> handler = browser_->client()->GetRenderHandler();
if (handler.get()) {
CefRefPtr<CefAccessibilityHandler> acchandler =
handler->GetAccessibilityHandler();
if (acchandler.get()) {
acchandler->OnAccessibilityLocationChange(
osr_accessibility_util::ParseAccessibilityLocationData(locData));
}
}
}
CefWindowHandle CefBrowserPlatformDelegateOsr::GetParentWindowHandle() const {
return GetHostWindowHandle();
}
......
......@@ -88,6 +88,12 @@ class CefBrowserPlatformDelegateOsr :
void DragSourceEndedAt(int x, int y,
cef_drag_operations_mask_t op) override;
void DragSourceSystemDragEnded() override;
void AccessibilityEventReceived(
const std::vector<content::AXEventNotificationDetails>& eventData)
override;
void AccessibilityLocationChangesReceived(
const std::vector<content::AXLocationChangeNotificationDetails>& locData)
override;
// CefBrowserPlatformDelegateNative::WindowlessHandler methods:
CefWindowHandle GetParentWindowHandle() const override;
......
This diff is collapsed.
// Copyright 2017 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_OSR_ACCESSIBILITY_UTIL_H_
#define CEF_LIBCEF_BROWSER_OSR_ACCESSIBILITY_UTIL_H_
#pragma once
#include <vector>
#include "include/cef_values.h"
namespace content {
struct AXEventNotificationDetails;
struct AXLocationChangeNotificationDetails;
}
namespace osr_accessibility_util {
// Convert Accessibility Event and location updates to CefValue, which may be
// consumed or serialized with CefJSONWrite.
CefRefPtr<CefValue> ParseAccessibilityEventData(
const std::vector<content::AXEventNotificationDetails>& data);
CefRefPtr<CefValue> ParseAccessibilityLocationData(
const std::vector<content::AXLocationChangeNotificationDetails>& data);
} // namespace osr_accessibility_util
#endif // CEF_LIBCEF_BROWSER_ACCESSIBILITY_UTIL_H_
......@@ -71,6 +71,20 @@ void CefWebContentsViewOSR::StoreFocus() {
void CefWebContentsViewOSR::RestoreFocus() {
}
void CefWebContentsViewOSR::GotFocus() {
if (web_contents_) {
content::WebContentsImpl* web_contents_impl =
static_cast<content::WebContentsImpl*>(web_contents_);
if (web_contents_impl)
web_contents_impl->NotifyWebContentsFocused();
}
}
void CefWebContentsViewOSR::TakeFocus(bool reverse) {
if (web_contents_->GetDelegate())
web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse);
}
content::DropData* CefWebContentsViewOSR::GetDropData() const {
return NULL;
}
......
......@@ -70,6 +70,8 @@ class CefWebContentsViewOSR : public content::WebContentsView,
const content::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh) override;
void UpdateDragCursor(blink::WebDragOperation operation) override;
virtual void GotFocus() override;
virtual void TakeFocus(bool reverse) override;
private:
CefRenderWidgetHostViewOSR* GetView() const;
......
// Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/accessibility_handler_cpptoc.h"
#include "libcef_dll/ctocpp/value_ctocpp.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK accessibility_handler_on_accessibility_tree_change(
struct _cef_accessibility_handler_t* self, struct _cef_value_t* value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: value; type: refptr_diff
DCHECK(value);
if (!value)
return;
// Execute
CefAccessibilityHandlerCppToC::Get(self)->OnAccessibilityTreeChange(
CefValueCToCpp::Wrap(value));
}
void CEF_CALLBACK accessibility_handler_on_accessibility_location_change(
struct _cef_accessibility_handler_t* self, struct _cef_value_t* value) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: value; type: refptr_diff
DCHECK(value);
if (!value)
return;
// Execute
CefAccessibilityHandlerCppToC::Get(self)->OnAccessibilityLocationChange(
CefValueCToCpp::Wrap(value));
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefAccessibilityHandlerCppToC::CefAccessibilityHandlerCppToC() {
GetStruct()->on_accessibility_tree_change =
accessibility_handler_on_accessibility_tree_change;
GetStruct()->on_accessibility_location_change =