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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.h

Issue 407493002: Revert of Migrate accessibility from RenderView to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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"
18 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
19 #include "content/common/mojo/service_registry_impl.h" 17 #include "content/common/mojo/service_registry_impl.h"
20 #include "content/public/browser/render_frame_host.h" 18 #include "content/public/browser/render_frame_host.h"
21 #include "content/public/common/javascript_message_type.h" 19 #include "content/public/common/javascript_message_type.h"
22 #include "content/public/common/page_transition_types.h" 20 #include "content/public/common/page_transition_types.h"
23 #include "third_party/WebKit/public/web/WebTextDirection.h" 21 #include "third_party/WebKit/public/web/WebTextDirection.h"
24 #include "ui/accessibility/ax_node_data.h"
25 22
26 class GURL; 23 class GURL;
27 struct AccessibilityHostMsg_EventParams;
28 struct AccessibilityHostMsg_LocationChangeParams;
29 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params; 24 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params;
30 struct FrameHostMsg_OpenURL_Params; 25 struct FrameHostMsg_OpenURL_Params;
31 struct FrameHostMsg_BeginNavigation_Params; 26 struct FrameHostMsg_BeginNavigation_Params;
32 struct FrameMsg_Navigate_Params; 27 struct FrameMsg_Navigate_Params;
33 28
34 namespace base { 29 namespace base {
35 class FilePath; 30 class FilePath;
36 class ListValue; 31 class ListValue;
37 } 32 }
38 33
39 namespace content { 34 namespace content {
40 35
41 class CrossProcessFrameConnector; 36 class CrossProcessFrameConnector;
42 class CrossSiteTransferringRequest; 37 class CrossSiteTransferringRequest;
43 class FrameTree; 38 class FrameTree;
44 class FrameTreeNode; 39 class FrameTreeNode;
45 class RenderFrameHostDelegate; 40 class RenderFrameHostDelegate;
46 class RenderFrameProxyHost; 41 class RenderFrameProxyHost;
47 class RenderProcessHost; 42 class RenderProcessHost;
48 class RenderViewHostImpl; 43 class RenderViewHostImpl;
49 class RenderWidgetHostImpl; 44 class RenderWidgetHostImpl;
50 struct ContextMenuParams; 45 struct ContextMenuParams;
51 struct GlobalRequestID; 46 struct GlobalRequestID;
52 struct Referrer; 47 struct Referrer;
53 struct ShowDesktopNotificationHostMsgParams; 48 struct ShowDesktopNotificationHostMsgParams;
54 49
55 class CONTENT_EXPORT RenderFrameHostImpl 50 class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost {
56 : public RenderFrameHost,
57 public BrowserAccessibilityDelegate {
58 public: 51 public:
59 static RenderFrameHostImpl* FromID(int process_id, int routing_id); 52 static RenderFrameHostImpl* FromID(int process_id, int routing_id);
60 53
61 virtual ~RenderFrameHostImpl(); 54 virtual ~RenderFrameHostImpl();
62 55
63 // RenderFrameHost 56 // RenderFrameHost
64 virtual int GetRoutingID() OVERRIDE; 57 virtual int GetRoutingID() OVERRIDE;
65 virtual SiteInstance* GetSiteInstance() OVERRIDE; 58 virtual SiteInstance* GetSiteInstance() OVERRIDE;
66 virtual RenderProcessHost* GetProcess() OVERRIDE; 59 virtual RenderProcessHost* GetProcess() OVERRIDE;
67 virtual RenderFrameHost* GetParent() OVERRIDE; 60 virtual RenderFrameHost* GetParent() OVERRIDE;
68 virtual const std::string& GetFrameName() OVERRIDE; 61 virtual const std::string& GetFrameName() OVERRIDE;
69 virtual bool IsCrossProcessSubframe() OVERRIDE; 62 virtual bool IsCrossProcessSubframe() OVERRIDE;
70 virtual GURL GetLastCommittedURL() OVERRIDE; 63 virtual GURL GetLastCommittedURL() OVERRIDE;
71 virtual gfx::NativeView GetNativeView() OVERRIDE; 64 virtual gfx::NativeView GetNativeView() OVERRIDE;
72 virtual void ExecuteJavaScript( 65 virtual void ExecuteJavaScript(
73 const base::string16& javascript) OVERRIDE; 66 const base::string16& javascript) OVERRIDE;
74 virtual void ExecuteJavaScript( 67 virtual void ExecuteJavaScript(
75 const base::string16& javascript, 68 const base::string16& javascript,
76 const JavaScriptResultCallback& callback) OVERRIDE; 69 const JavaScriptResultCallback& callback) OVERRIDE;
77 virtual RenderViewHost* GetRenderViewHost() OVERRIDE; 70 virtual RenderViewHost* GetRenderViewHost() OVERRIDE;
78 virtual ServiceRegistry* GetServiceRegistry() OVERRIDE; 71 virtual ServiceRegistry* GetServiceRegistry() OVERRIDE;
79 72
80 // IPC::Sender 73 // IPC::Sender
81 virtual bool Send(IPC::Message* msg) OVERRIDE; 74 virtual bool Send(IPC::Message* msg) OVERRIDE;
82 75
83 // IPC::Listener 76 // IPC::Listener
84 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 77 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
85 78
86 // BrowserAccessibilityDelegate
87 virtual void AccessibilitySetFocus(int acc_obj_id) OVERRIDE;
88 virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE;
89 virtual void AccessibilityShowMenu(const gfx::Point& global_point) OVERRIDE;
90 virtual void AccessibilityScrollToMakeVisible(
91 int acc_obj_id, const gfx::Rect& subfocus) OVERRIDE;
92 virtual void AccessibilityScrollToPoint(
93 int acc_obj_id, const gfx::Point& point) OVERRIDE;
94 virtual void AccessibilitySetTextSelection(
95 int acc_obj_id, int start_offset, int end_offset) OVERRIDE;
96 virtual bool AccessibilityViewHasFocus() const OVERRIDE;
97 virtual gfx::Rect AccessibilityGetViewBounds() const OVERRIDE;
98 virtual gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds)
99 const OVERRIDE;
100 virtual void AccessibilityHitTest(const gfx::Point& point) OVERRIDE;
101 virtual void AccessibilityFatalError() OVERRIDE;
102
103 void Init(); 79 void Init();
104 int routing_id() const { return routing_id_; } 80 int routing_id() const { return routing_id_; }
105 void OnCreateChildFrame(int new_routing_id, 81 void OnCreateChildFrame(int new_routing_id,
106 const std::string& frame_name); 82 const std::string& frame_name);
107 83
108 RenderViewHostImpl* render_view_host() { return render_view_host_; } 84 RenderViewHostImpl* render_view_host() { return render_view_host_; }
109 RenderFrameHostDelegate* delegate() { return delegate_; } 85 RenderFrameHostDelegate* delegate() { return delegate_; }
110 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } 86 FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
111 // TODO(nasko): The RenderWidgetHost will be owned by RenderFrameHost in 87 // TODO(nasko): The RenderWidgetHost will be owned by RenderFrameHost in
112 // the future, so update this accessor to return the right pointer. 88 // the future, so update this accessor to return the right pointer.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 bool dialog_was_suppressed); 172 bool dialog_was_suppressed);
197 173
198 // Called when an HTML5 notification is closed. 174 // Called when an HTML5 notification is closed.
199 void NotificationClosed(int notification_id); 175 void NotificationClosed(int notification_id);
200 176
201 // Sets whether there is an outstanding transition request. This is called at 177 // Sets whether there is an outstanding transition request. This is called at
202 // the start of a provisional load for the main frame, and cleared when we 178 // the start of a provisional load for the main frame, and cleared when we
203 // hear the response or commit. 179 // hear the response or commit.
204 void SetHasPendingTransitionRequest(bool has_pending_request); 180 void SetHasPendingTransitionRequest(bool has_pending_request);
205 181
206 // Send a message to the renderer process to change the accessibility mode.
207 void SetAccessibilityMode(AccessibilityMode AccessibilityMode);
208
209 // Turn on accessibility testing. The given callback will be run
210 // every time an accessibility notification is received from the
211 // renderer process, and the accessibility tree it sent can be
212 // retrieved using GetAXTreeForTesting().
213 void SetAccessibilityCallbackForTesting(
214 const base::Callback<void(ui::AXEvent, int)>& callback);
215
216 // Returns a snapshot of the accessibility tree received from the
217 // renderer as of the last time an accessibility notification was
218 // received.
219 const ui::AXTree* GetAXTreeForTesting();
220
221 // Access the BrowserAccessibilityManager if it already exists.
222 BrowserAccessibilityManager* browser_accessibility_manager() const {
223 return browser_accessibility_manager_.get();
224 }
225
226 // If accessibility is enabled, get the BrowserAccessibilityManager for
227 // this frame, or create one if it doesn't exist yet, otherwise return
228 // NULL.
229 BrowserAccessibilityManager* GetOrCreateBrowserAccessibilityManager();
230
231 #if defined(OS_WIN)
232 void SetParentNativeViewAccessible(
233 gfx::NativeViewAccessible accessible_parent);
234 gfx::NativeViewAccessible GetParentNativeViewAccessible() const;
235 #endif
236
237 protected: 182 protected:
238 friend class RenderFrameHostFactory; 183 friend class RenderFrameHostFactory;
239 184
240 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost 185 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost
241 // should be the abstraction needed here, but we need RenderViewHost to pass 186 // should be the abstraction needed here, but we need RenderViewHost to pass
242 // into WebContentsObserver::FrameDetached for now. 187 // into WebContentsObserver::FrameDetached for now.
243 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, 188 RenderFrameHostImpl(RenderViewHostImpl* render_view_host,
244 RenderFrameHostDelegate* delegate, 189 RenderFrameHostDelegate* delegate,
245 FrameTree* frame_tree, 190 FrameTree* frame_tree,
246 FrameTreeNode* frame_tree_node, 191 FrameTreeNode* frame_tree_node,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 size_t start_offset, 242 size_t start_offset,
298 size_t end_offset); 243 size_t end_offset);
299 void OnDidAccessInitialDocument(); 244 void OnDidAccessInitialDocument();
300 void OnDidDisownOpener(); 245 void OnDidDisownOpener();
301 void OnUpdateTitle(int32 page_id, 246 void OnUpdateTitle(int32 page_id,
302 const base::string16& title, 247 const base::string16& title,
303 blink::WebTextDirection title_direction); 248 blink::WebTextDirection title_direction);
304 void OnUpdateEncoding(const std::string& encoding); 249 void OnUpdateEncoding(const std::string& encoding);
305 void OnBeginNavigation( 250 void OnBeginNavigation(
306 const FrameHostMsg_BeginNavigation_Params& params); 251 const FrameHostMsg_BeginNavigation_Params& params);
307 void OnAccessibilityEvents(
308 const std::vector<AccessibilityHostMsg_EventParams>& params);
309 void OnAccessibilityLocationChanges(
310 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params);
311 252
312 // Returns whether the given URL is allowed to commit in the current process. 253 // Returns whether the given URL is allowed to commit in the current process.
313 // This is a more conservative check than RenderProcessHost::FilterURL, since 254 // This is a more conservative check than RenderProcessHost::FilterURL, since
314 // it will be used to kill processes that commit unauthorized URLs. 255 // it will be used to kill processes that commit unauthorized URLs.
315 bool CanCommitURL(const GURL& url); 256 bool CanCommitURL(const GURL& url);
316 257
317 void DesktopNotificationPermissionRequestDone(int callback_context); 258 void DesktopNotificationPermissionRequestDone(int callback_context);
318 259
319 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a 260 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a
320 // refcount that calls Shutdown when it reaches zero. This allows each 261 // refcount that calls Shutdown when it reaches zero. This allows each
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 int routing_id_; 303 int routing_id_;
363 bool is_swapped_out_; 304 bool is_swapped_out_;
364 305
365 // When the last BeforeUnload message was sent. 306 // When the last BeforeUnload message was sent.
366 base::TimeTicks send_before_unload_start_time_; 307 base::TimeTicks send_before_unload_start_time_;
367 308
368 ServiceRegistryImpl service_registry_; 309 ServiceRegistryImpl service_registry_;
369 310
370 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 311 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
371 312
372 scoped_ptr<BrowserAccessibilityManager> browser_accessibility_manager_;
373
374 // Callback when an event is received, for testing.
375 base::Callback<void(ui::AXEvent, int)> accessibility_testing_callback_;
376 // The most recently received accessibility tree - for testing only.
377 scoped_ptr<ui::AXTree> ax_tree_for_testing_;
378
379 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 313 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
380 }; 314 };
381 315
382 } // namespace content 316 } // namespace content
383 317
384 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 318 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_delegate.cc ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698