Index: content/browser/frame_host/render_frame_host_impl.h |
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h |
index 2d7036d0b1a8ae4297c36dca318cf86318daf62d..08f110c5b670b2cf5692d8cc329df25f432dcc18 100644 |
--- a/content/browser/frame_host/render_frame_host_impl.h |
+++ b/content/browser/frame_host/render_frame_host_impl.h |
@@ -13,14 +13,19 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/strings/string16.h" |
#include "base/time/time.h" |
+#include "content/browser/accessibility/browser_accessibility_manager.h" |
+#include "content/common/accessibility_mode_enums.h" |
#include "content/common/content_export.h" |
#include "content/common/mojo/service_registry_impl.h" |
#include "content/public/browser/render_frame_host.h" |
#include "content/public/common/javascript_message_type.h" |
#include "content/public/common/page_transition_types.h" |
#include "third_party/WebKit/public/web/WebTextDirection.h" |
+#include "ui/accessibility/ax_node_data.h" |
class GURL; |
+struct AccessibilityHostMsg_EventParams; |
+struct AccessibilityHostMsg_LocationChangeParams; |
struct FrameHostMsg_DidFailProvisionalLoadWithError_Params; |
struct FrameHostMsg_OpenURL_Params; |
struct FrameMsg_Navigate_Params; |
@@ -46,7 +51,9 @@ struct GlobalRequestID; |
struct Referrer; |
struct ShowDesktopNotificationHostMsgParams; |
-class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost { |
+class CONTENT_EXPORT RenderFrameHostImpl |
+ : public RenderFrameHost, |
+ public BrowserAccessibilityDelegate { |
public: |
static RenderFrameHostImpl* FromID(int process_id, int routing_id); |
@@ -75,6 +82,23 @@ class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost { |
// IPC::Listener |
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
+ // BrowserAccessibilityDelegate |
+ virtual void AccessibilitySetFocus(int acc_obj_id) OVERRIDE; |
+ virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE; |
+ virtual void AccessibilityShowMenu(const gfx::Point& point) OVERRIDE; |
+ virtual void AccessibilityScrollToMakeVisible( |
+ int acc_obj_id, gfx::Rect subfocus) OVERRIDE; |
ncarter (slow)
2014/07/15 01:23:28
Probably worth passing the gfx::Rect as a const re
dmazzoni
2014/07/15 07:55:04
Done.
|
+ virtual void AccessibilityScrollToPoint( |
+ int acc_obj_id, gfx::Point point) OVERRIDE; |
+ virtual void AccessibilitySetTextSelection( |
+ int acc_obj_id, int start_offset, int end_offset) OVERRIDE; |
+ virtual bool AccessibilityViewHasFocus() const OVERRIDE; |
+ virtual gfx::Rect AccessibilityGetViewBounds() const OVERRIDE; |
+ virtual gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds) |
+ const OVERRIDE; |
+ virtual void AccessibilityHitTest(const gfx::Point& point) OVERRIDE; |
+ virtual void AccessibilityFatalError() OVERRIDE; |
+ |
void Init(); |
int routing_id() const { return routing_id_; } |
void OnCreateChildFrame(int new_routing_id, |
@@ -178,6 +202,42 @@ class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost { |
// hear the response or commit. |
void SetHasPendingTransitionRequest(bool has_pending_request); |
+ // Gets the accessibility mode. |
+ AccessibilityMode accessibility_mode() const { |
+ return accessibility_mode_; |
David Tseng
2014/07/14 19:08:02
Does each frame get its own accessibility mode? If
dmazzoni
2014/07/15 07:55:04
This change already made the WebContents have the
|
+ } |
+ |
+ // Send a message to the renderer process to change the accessibility mode. |
+ void SetAccessibilityMode(AccessibilityMode AccessibilityMode); |
+ |
+ // Turn on accessibility testing. The given callback will be run |
+ // every time an accessibility notification is received from the |
+ // renderer process, and the accessibility tree it sent can be |
+ // retrieved using GetAXTreeForTesting(). |
David Tseng
2014/07/14 19:08:02
Why not just pass the ax tree as a param of the ca
dmazzoni
2014/07/15 07:55:04
Often the callback is used by the accessibility wa
|
+ void SetAccessibilityCallbackForTesting( |
+ const base::Callback<void(ui::AXEvent, int)>& callback); |
+ |
+ // Returns a snapshot of the accessibility tree received from the |
+ // renderer as of the last time an accessibility notification was |
+ // received. |
+ const ui::AXTree* GetAXTreeForTesting(); |
David Tseng
2014/07/14 19:08:02
Not really needed; see above.
|
+ |
+ // Access the BrowserAccessibilityManager if it already exists. |
+ BrowserAccessibilityManager* browser_accessibility_manager() const { |
David Tseng
2014/07/14 19:08:02
How do you feel about naming this RenderFrameHostA
dmazzoni
2014/07/15 07:55:04
I was thinking FrameAccessibility or FrameHostAcce
|
+ return browser_accessibility_manager_.get(); |
+ } |
+ |
+ // If accessibility is enabled, get the BrowserAccessibilityManager for |
+ // this frame, or create one if it doesn't exist yet, otherwise return |
+ // NULL. |
+ BrowserAccessibilityManager* GetOrCreateBrowserAccessibilityManager(); |
+ |
+#if defined(OS_WIN) |
+ void SetParentNativeViewAccessible( |
+ gfx::NativeViewAccessible accessible_parent); |
+ gfx::NativeViewAccessible GetParentNativeViewAccessible() const; |
+#endif |
+ |
protected: |
friend class RenderFrameHostFactory; |
@@ -246,6 +306,10 @@ class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost { |
const base::string16& title, |
blink::WebTextDirection title_direction); |
void OnUpdateEncoding(const std::string& encoding); |
+ void OnAccessibilityEvents( |
+ const std::vector<AccessibilityHostMsg_EventParams>& params); |
+ void OnAccessibilityLocationChanges( |
+ const std::vector<AccessibilityHostMsg_LocationChangeParams>& params); |
// Returns whether the given URL is allowed to commit in the current process. |
// This is a more conservative check than RenderProcessHost::FilterURL, since |
@@ -307,6 +371,12 @@ class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost { |
base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
+ AccessibilityMode accessibility_mode_; |
+ base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_; |
+ // The most recently received accessibility tree - for testing only. |
David Tseng
2014/07/14 19:08:02
Are we ok with test only members?
ncarter (slow)
2014/07/15 01:23:28
I also would rather we not have test-only members,
dmazzoni
2014/07/15 07:55:04
Yeah, I'm happy to work on ways to do this without
|
+ scoped_ptr<ui::AXTree> ax_tree_for_testing_; |
+ scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_; |
David Tseng
2014/07/14 19:08:02
Seems like test members should go last?
dmazzoni
2014/07/15 07:55:04
Done.
|
+ |
DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
}; |