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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "content/browser/accessibility/browser_accessibility_manager.h"
17 #include "content/common/accessibility_mode_enums.h"
16 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
17 #include "content/public/browser/render_frame_host.h" 19 #include "content/public/browser/render_frame_host.h"
18 #include "content/public/common/javascript_message_type.h" 20 #include "content/public/common/javascript_message_type.h"
19 #include "content/public/common/page_transition_types.h" 21 #include "content/public/common/page_transition_types.h"
22 #include "ui/accessibility/ax_node_data.h"
20 23
21 class GURL; 24 class GURL;
25 struct AccessibilityHostMsg_EventParams;
26 struct AccessibilityHostMsg_LocationChangeParams;
22 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params; 27 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params;
23 struct FrameHostMsg_OpenURL_Params; 28 struct FrameHostMsg_OpenURL_Params;
24 struct FrameMsg_Navigate_Params; 29 struct FrameMsg_Navigate_Params;
25 30
26 namespace base { 31 namespace base {
27 class FilePath; 32 class FilePath;
28 class ListValue; 33 class ListValue;
29 } 34 }
30 35
31 namespace content { 36 namespace content {
32 37
33 class CrossProcessFrameConnector; 38 class CrossProcessFrameConnector;
34 class CrossSiteTransferringRequest; 39 class CrossSiteTransferringRequest;
35 class FrameTree; 40 class FrameTree;
36 class FrameTreeNode; 41 class FrameTreeNode;
37 class RenderFrameHostDelegate; 42 class RenderFrameHostDelegate;
38 class RenderProcessHost; 43 class RenderProcessHost;
39 class RenderViewHostImpl; 44 class RenderViewHostImpl;
40 struct ContextMenuParams; 45 struct ContextMenuParams;
41 struct GlobalRequestID; 46 struct GlobalRequestID;
42 struct Referrer; 47 struct Referrer;
43 struct ShowDesktopNotificationHostMsgParams; 48 struct ShowDesktopNotificationHostMsgParams;
44 49
45 class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost { 50 class CONTENT_EXPORT RenderFrameHostImpl
51 : public RenderFrameHost,
52 public BrowserAccessibilityDelegate {
46 public: 53 public:
47 static RenderFrameHostImpl* FromID(int process_id, int routing_id); 54 static RenderFrameHostImpl* FromID(int process_id, int routing_id);
48 55
49 virtual ~RenderFrameHostImpl(); 56 virtual ~RenderFrameHostImpl();
50 57
51 // RenderFrameHost 58 // RenderFrameHost
52 virtual int GetRoutingID() OVERRIDE; 59 virtual int GetRoutingID() OVERRIDE;
53 virtual SiteInstance* GetSiteInstance() OVERRIDE; 60 virtual SiteInstance* GetSiteInstance() OVERRIDE;
54 virtual RenderProcessHost* GetProcess() OVERRIDE; 61 virtual RenderProcessHost* GetProcess() OVERRIDE;
55 virtual RenderFrameHost* GetParent() OVERRIDE; 62 virtual RenderFrameHost* GetParent() OVERRIDE;
56 virtual const std::string& GetFrameName() OVERRIDE; 63 virtual const std::string& GetFrameName() OVERRIDE;
57 virtual bool IsCrossProcessSubframe() OVERRIDE; 64 virtual bool IsCrossProcessSubframe() OVERRIDE;
58 virtual GURL GetLastCommittedURL() OVERRIDE; 65 virtual GURL GetLastCommittedURL() OVERRIDE;
59 virtual gfx::NativeView GetNativeView() OVERRIDE; 66 virtual gfx::NativeView GetNativeView() OVERRIDE;
60 virtual void ExecuteJavaScript( 67 virtual void ExecuteJavaScript(
61 const base::string16& javascript) OVERRIDE; 68 const base::string16& javascript) OVERRIDE;
62 virtual void ExecuteJavaScript( 69 virtual void ExecuteJavaScript(
63 const base::string16& javascript, 70 const base::string16& javascript,
64 const JavaScriptResultCallback& callback) OVERRIDE; 71 const JavaScriptResultCallback& callback) OVERRIDE;
65 virtual RenderViewHost* GetRenderViewHost() OVERRIDE; 72 virtual RenderViewHost* GetRenderViewHost() OVERRIDE;
66 73
67 // IPC::Sender 74 // IPC::Sender
68 virtual bool Send(IPC::Message* msg) OVERRIDE; 75 virtual bool Send(IPC::Message* msg) OVERRIDE;
69 76
70 // IPC::Listener 77 // IPC::Listener
71 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 78 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
72 79
80 // BrowserAccessibilityDelegate
81 virtual void AccessibilitySetFocus(int acc_obj_id) OVERRIDE;
82 virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE;
83 virtual void AccessibilityShowMenu(int acc_obj_id) OVERRIDE;
84 virtual void AccessibilityScrollToMakeVisible(
85 int acc_obj_id, gfx::Rect subfocus) OVERRIDE;
86 virtual void AccessibilityScrollToPoint(
87 int acc_obj_id, gfx::Point point) OVERRIDE;
88 virtual void AccessibilitySetTextSelection(
89 int acc_obj_id, int start_offset, int end_offset) OVERRIDE;
90 virtual bool AccessibilityViewHasFocus() const OVERRIDE;
91 virtual gfx::Rect AccessibilityGetViewBounds() const OVERRIDE;
92 virtual gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds)
93 const OVERRIDE;
94 virtual void AccessibilityFatalError() OVERRIDE;
95
73 void Init(); 96 void Init();
74 int routing_id() const { return routing_id_; } 97 int routing_id() const { return routing_id_; }
75 void OnCreateChildFrame(int new_routing_id, 98 void OnCreateChildFrame(int new_routing_id,
76 const std::string& frame_name); 99 const std::string& frame_name);
77 100
78 RenderViewHostImpl* render_view_host() { return render_view_host_; } 101 RenderViewHostImpl* render_view_host() { return render_view_host_; }
79 RenderFrameHostDelegate* delegate() { return delegate_; } 102 RenderFrameHostDelegate* delegate() { return delegate_; }
80 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } 103 FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
81 104
82 // This function is called when this is a swapped out RenderFrameHost that 105 // This function is called when this is a swapped out RenderFrameHost that
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Notifies the RenderFrame that the JavaScript message that was shown was 179 // Notifies the RenderFrame that the JavaScript message that was shown was
157 // closed by the user. 180 // closed by the user.
158 void JavaScriptDialogClosed(IPC::Message* reply_msg, 181 void JavaScriptDialogClosed(IPC::Message* reply_msg,
159 bool success, 182 bool success,
160 const base::string16& user_input, 183 const base::string16& user_input,
161 bool dialog_was_suppressed); 184 bool dialog_was_suppressed);
162 185
163 // Called when an HTML5 notification is closed. 186 // Called when an HTML5 notification is closed.
164 void NotificationClosed(int notification_id); 187 void NotificationClosed(int notification_id);
165 188
189 // Gets the accessibility mode.
190 AccessibilityMode accessibility_mode() const {
191 return accessibility_mode_;
192 }
193
194 // Send a message to the renderer process to change the accessibility mode.
195 void SetAccessibilityMode(AccessibilityMode AccessibilityMode);
196
197 // Turn on accessibility testing. The given callback will be run
198 // every time an accessibility notification is received from the
199 // renderer process, and the accessibility tree it sent can be
200 // retrieved using GetAXTreeForTesting().
201 void SetAccessibilityCallbackForTesting(
202 const base::Callback<void(ui::AXEvent)>& callback);
203
204 // Returns a snapshot of the accessibility tree received from the
205 // renderer as of the last time an accessibility notification was
206 // received.
207 const ui::AXTree* GetAXTreeForTesting();
208
209 #if defined(OS_WIN)
210 void SetParentNativeViewAccessible(
211 gfx::NativeViewAccessible accessible_parent);
212 gfx::NativeViewAccessible GetParentNativeViewAccessible() const;
213 #endif
214
166 protected: 215 protected:
167 friend class RenderFrameHostFactory; 216 friend class RenderFrameHostFactory;
168 217
169 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost 218 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost
170 // should be the abstraction needed here, but we need RenderViewHost to pass 219 // should be the abstraction needed here, but we need RenderViewHost to pass
171 // into WebContentsObserver::FrameDetached for now. 220 // into WebContentsObserver::FrameDetached for now.
172 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, 221 RenderFrameHostImpl(RenderViewHostImpl* render_view_host,
173 RenderFrameHostDelegate* delegate, 222 RenderFrameHostDelegate* delegate,
174 FrameTree* frame_tree, 223 FrameTree* frame_tree,
175 FrameTreeNode* frame_tree_node, 224 FrameTreeNode* frame_tree_node,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 bool is_reload, 268 bool is_reload,
220 IPC::Message* reply_msg); 269 IPC::Message* reply_msg);
221 void OnRequestDesktopNotificationPermission(const GURL& origin, 270 void OnRequestDesktopNotificationPermission(const GURL& origin,
222 int callback_id); 271 int callback_id);
223 void OnShowDesktopNotification( 272 void OnShowDesktopNotification(
224 int notification_id, 273 int notification_id,
225 const ShowDesktopNotificationHostMsgParams& params); 274 const ShowDesktopNotificationHostMsgParams& params);
226 void OnCancelDesktopNotification(int notification_id); 275 void OnCancelDesktopNotification(int notification_id);
227 void OnDidAccessInitialDocument(); 276 void OnDidAccessInitialDocument();
228 void OnDidDisownOpener(); 277 void OnDidDisownOpener();
278 void OnAccessibilityEvents(
279 const std::vector<AccessibilityHostMsg_EventParams>& params);
280 void OnAccessibilityLocationChanges(
281 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params);
229 282
230 // Returns whether the given URL is allowed to commit in the current process. 283 // Returns whether the given URL is allowed to commit in the current process.
231 // This is a more conservative check than RenderProcessHost::FilterURL, since 284 // This is a more conservative check than RenderProcessHost::FilterURL, since
232 // it will be used to kill processes that commit unauthorized URLs. 285 // it will be used to kill processes that commit unauthorized URLs.
233 bool CanCommitURL(const GURL& url); 286 bool CanCommitURL(const GURL& url);
234 287
235 void DesktopNotificationPermissionRequestDone(int callback_context); 288 void DesktopNotificationPermissionRequestDone(int callback_context);
236 289
237 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a 290 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a
238 // refcount that calls Shutdown when it reaches zero. This allows each 291 // refcount that calls Shutdown when it reaches zero. This allows each
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 std::map<int, base::Closure> cancel_notification_callbacks_; 325 std::map<int, base::Closure> cancel_notification_callbacks_;
273 326
274 int routing_id_; 327 int routing_id_;
275 bool is_swapped_out_; 328 bool is_swapped_out_;
276 329
277 // When the last BeforeUnload message was sent. 330 // When the last BeforeUnload message was sent.
278 base::TimeTicks send_before_unload_start_time_; 331 base::TimeTicks send_before_unload_start_time_;
279 332
280 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 333 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
281 334
335 AccessibilityMode accessibility_mode_;
336 base::Callback<void(ui::AXEvent)> accessibility_testing_callback_;
337 // The most recently received accessibility tree - for testing only.
338 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.
339
282 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 340 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
283 }; 341 };
284 342
285 } // namespace content 343 } // namespace content
286 344
287 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 345 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698