Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(988)

Unified Diff: content/browser/frame_host/render_frame_host_impl.h

Issue 273423004: Migrate accessibility from RenderView to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 3acb62629e115ed247aa21dcb2386cea1ed83397..32c3f6ed889231b2190ea1e799ef66984831d5d7 100644
--- a/content/browser/frame_host/render_frame_host_impl.h
+++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -13,12 +13,17 @@
#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/public/browser/render_frame_host.h"
#include "content/public/common/javascript_message_type.h"
#include "content/public/common/page_transition_types.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;
@@ -42,7 +47,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);
@@ -70,6 +77,22 @@ 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(int acc_obj_id) OVERRIDE;
+ virtual void AccessibilityScrollToMakeVisible(
+ int acc_obj_id, gfx::Rect subfocus) OVERRIDE;
+ 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 AccessibilityFatalError() OVERRIDE;
+
void Init();
int routing_id() const { return routing_id_; }
void OnCreateChildFrame(int new_routing_id,
@@ -163,6 +186,32 @@ class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost {
// Called when an HTML5 notification is closed.
void NotificationClosed(int notification_id);
+ // Gets the accessibility mode.
+ AccessibilityMode accessibility_mode() const {
+ return accessibility_mode_;
+ }
+
+ // 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().
+ void SetAccessibilityCallbackForTesting(
+ const base::Callback<void(ui::AXEvent)>& 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();
+
+#if defined(OS_WIN)
+ void SetParentNativeViewAccessible(
+ gfx::NativeViewAccessible accessible_parent);
+ gfx::NativeViewAccessible GetParentNativeViewAccessible() const;
+#endif
+
protected:
friend class RenderFrameHostFactory;
@@ -226,6 +275,10 @@ class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost {
void OnCancelDesktopNotification(int notification_id);
void OnDidAccessInitialDocument();
void OnDidDisownOpener();
+ 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
@@ -279,6 +332,11 @@ class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost {
base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
+ AccessibilityMode accessibility_mode_;
+ base::Callback<void(ui::AXEvent)> accessibility_testing_callback_;
+ // The most recently received accessibility tree - for testing only.
+ scoped_ptr<ui::AXTree> ax_tree_;
nasko 2014/05/12 17:28:01 Let's label the variable to indicate it is to be u
dmazzoni 2014/05/13 06:36:52 Done.
+
DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
};

Powered by Google App Engine
This is Rietveld 408576698