Migrate accessibility from RenderView to RenderFrame and RVH to RFH.

In preparation for out-of-process iframes, move almost all accessibility
functionality from RenderView to RenderFrame, and from RVHI and RWHI
to RFHI.

In addition, the accessibility mode is moved to WebContents, and changing
the mode triggers changing it on all frames.

BUG=368298
[email protected], [email protected], [email protected]

Review URL: https://codereview.chromium.org/273423004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285767 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/public/browser/render_frame_host.h b/content/public/browser/render_frame_host.h
index 31f4d8d..dde20fe3 100644
--- a/content/public/browser/render_frame_host.h
+++ b/content/public/browser/render_frame_host.h
@@ -12,6 +12,7 @@
 #include "ipc/ipc_listener.h"
 #include "ipc/ipc_sender.h"
 #include "ui/gfx/native_widget_types.h"
+#include "ui/gfx/rect.h"
 #include "url/gurl.h"
 
 namespace base {
@@ -72,6 +73,14 @@
   virtual void ExecuteJavaScript(const base::string16& javascript,
                                  const JavaScriptResultCallback& callback) = 0;
 
+  // Accessibility actions.
+  virtual void AccessibilitySetFocus(int acc_obj_id) = 0;
+  virtual void AccessibilityDoDefaultAction(int acc_obj_id) = 0;
+  virtual void AccessibilityScrollToMakeVisible(
+      int acc_obj_id, const gfx::Rect& subfocus) = 0;
+  virtual void AccessibilitySetTextSelection(
+      int acc_obj_id, int start_offset, int end_offset) = 0;
+
   // Temporary until we get rid of RenderViewHost.
   virtual RenderViewHost* GetRenderViewHost() = 0;
 
diff --git a/content/public/browser/render_widget_host.h b/content/public/browser/render_widget_host.h
index 049ee70..a87e3fa 100644
--- a/content/public/browser/render_widget_host.h
+++ b/content/public/browser/render_widget_host.h
@@ -189,42 +189,6 @@
   virtual void UnlockBackingStore() = 0;
 #endif
 
-  // Send a command to the renderer to turn on full accessibility.
-  virtual void EnableFullAccessibilityMode() = 0;
-
-  // Check whether this RenderWidget has full accessibility mode.
-  virtual bool IsFullAccessibilityModeForTesting() = 0;
-
-  // Send a command to the renderer to turn on tree only accessibility.
-  virtual void EnableTreeOnlyAccessibilityMode() = 0;
-
-  // Check whether this RenderWidget has tree-only accessibility mode.
-  virtual bool IsTreeOnlyAccessibilityModeForTesting() = 0;
-
-  // Relay a request from assistive technology to perform the default action
-  // on a given node.
-  virtual void AccessibilityDoDefaultAction(int object_id) = 0;
-
-  // Relay a request from assistive technology to set focus to a given node.
-  virtual void AccessibilitySetFocus(int object_id) = 0;
-
-  // Relay a request from assistive technology to make a given object
-  // visible by scrolling as many scrollable containers as necessary.
-  // In addition, if it's not possible to make the entire object visible,
-  // scroll so that the |subfocus| rect is visible at least. The subfocus
-  // rect is in local coordinates of the object itself.
-  virtual void AccessibilityScrollToMakeVisible(
-      int acc_obj_id, gfx::Rect subfocus) = 0;
-
-  // Relay a request from assistive technology to move a given object
-  // to a specific location, in the WebContents area coordinate space, i.e.
-  // (0, 0) is the top-left corner of the WebContents.
-  virtual void AccessibilityScrollToPoint(int acc_obj_id, gfx::Point point) = 0;
-
-  // Relay a request from assistive technology to set text selection.
-  virtual void AccessibilitySetTextSelection(
-      int acc_obj_id, int start_offset, int end_offset) = 0;
-
   // Forwards the given message to the renderer. These are called by
   // the view when it has received a message.
   virtual void ForwardMouseEvent(
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index b39553e..b163306 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -222,6 +222,18 @@
   virtual void SetUserAgentOverride(const std::string& override) = 0;
   virtual const std::string& GetUserAgentOverride() const = 0;
 
+  // Enable the accessibility tree for this WebContents in the renderer,
+  // but don't enable creating a native accessibility tree on the browser
+  // side.
+  virtual void EnableTreeOnlyAccessibilityMode() = 0;
+
+  // Returns true only if "tree only" accessibility mode is on.
+  virtual bool IsTreeOnlyAccessibilityModeForTesting() const = 0;
+
+  // Returns true only if complete accessibility mode is on, meaning there's
+  // both renderer accessibility, and a native browser accessibility tree.
+  virtual bool IsFullAccessibilityModeForTesting() const = 0;
+
 #if defined(OS_WIN)
   virtual void SetParentNativeViewAccessible(
       gfx::NativeViewAccessible accessible_parent) = 0;