OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "content/browser/frame_host/frame_tree.h" | 18 #include "content/browser/frame_host/frame_tree.h" |
19 #include "content/browser/frame_host/navigation_controller_delegate.h" | 19 #include "content/browser/frame_host/navigation_controller_delegate.h" |
20 #include "content/browser/frame_host/navigation_controller_impl.h" | 20 #include "content/browser/frame_host/navigation_controller_impl.h" |
21 #include "content/browser/frame_host/navigator_delegate.h" | 21 #include "content/browser/frame_host/navigator_delegate.h" |
22 #include "content/browser/frame_host/render_frame_host_delegate.h" | 22 #include "content/browser/frame_host/render_frame_host_delegate.h" |
23 #include "content/browser/frame_host/render_frame_host_manager.h" | 23 #include "content/browser/frame_host/render_frame_host_manager.h" |
24 #include "content/browser/renderer_host/render_view_host_delegate.h" | 24 #include "content/browser/renderer_host/render_view_host_delegate.h" |
25 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 25 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 26 #include "content/common/accessibility_mode_enums.h" |
26 #include "content/common/content_export.h" | 27 #include "content/common/content_export.h" |
27 #include "content/public/browser/color_chooser.h" | 28 #include "content/public/browser/color_chooser.h" |
28 #include "content/public/browser/notification_observer.h" | 29 #include "content/public/browser/notification_observer.h" |
29 #include "content/public/browser/notification_registrar.h" | 30 #include "content/public/browser/notification_registrar.h" |
30 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
31 #include "content/public/common/page_transition_types.h" | 32 #include "content/public/common/page_transition_types.h" |
32 #include "content/public/common/renderer_preferences.h" | 33 #include "content/public/common/renderer_preferences.h" |
33 #include "content/public/common/three_d_api_types.h" | 34 #include "content/public/common/three_d_api_types.h" |
34 #include "net/base/load_states.h" | 35 #include "net/base/load_states.h" |
35 #include "third_party/WebKit/public/web/WebDragOperation.h" | 36 #include "third_party/WebKit/public/web/WebDragOperation.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 public NotificationObserver, | 88 public NotificationObserver, |
88 public NON_EXPORTED_BASE(NavigationControllerDelegate), | 89 public NON_EXPORTED_BASE(NavigationControllerDelegate), |
89 public NON_EXPORTED_BASE(NavigatorDelegate) { | 90 public NON_EXPORTED_BASE(NavigatorDelegate) { |
90 public: | 91 public: |
91 virtual ~WebContentsImpl(); | 92 virtual ~WebContentsImpl(); |
92 | 93 |
93 static WebContentsImpl* CreateWithOpener( | 94 static WebContentsImpl* CreateWithOpener( |
94 const WebContents::CreateParams& params, | 95 const WebContents::CreateParams& params, |
95 WebContentsImpl* opener); | 96 WebContentsImpl* opener); |
96 | 97 |
| 98 static std::vector<WebContentsImpl*> GetAllWebContents(); |
| 99 |
97 // Returns the opener WebContentsImpl, if any. This can be set to null if the | 100 // Returns the opener WebContentsImpl, if any. This can be set to null if the |
98 // opener is closed or the page clears its window.opener. | 101 // opener is closed or the page clears its window.opener. |
99 WebContentsImpl* opener() const { return opener_; } | 102 WebContentsImpl* opener() const { return opener_; } |
100 | 103 |
101 // Creates a swapped out RenderView. This is used by the browser plugin to | 104 // Creates a swapped out RenderView. This is used by the browser plugin to |
102 // create a swapped out RenderView in the embedder render process for the | 105 // create a swapped out RenderView in the embedder render process for the |
103 // guest, to expose the guest's window object to the embedder. | 106 // guest, to expose the guest's window object to the embedder. |
104 // This returns the routing ID of the newly created swapped out RenderView. | 107 // This returns the routing ID of the newly created swapped out RenderView. |
105 int CreateSwappedOutRenderView(SiteInstance* instance); | 108 int CreateSwappedOutRenderView(SiteInstance* instance); |
106 | 109 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 void DidGetRedirectForResourceRequest( | 160 void DidGetRedirectForResourceRequest( |
158 RenderViewHost* render_view_host, | 161 RenderViewHost* render_view_host, |
159 const ResourceRedirectDetails& details); | 162 const ResourceRedirectDetails& details); |
160 | 163 |
161 WebContentsView* GetView() const; | 164 WebContentsView* GetView() const; |
162 | 165 |
163 GeolocationDispatcherHost* geolocation_dispatcher_host() { | 166 GeolocationDispatcherHost* geolocation_dispatcher_host() { |
164 return geolocation_dispatcher_host_.get(); | 167 return geolocation_dispatcher_host_.get(); |
165 } | 168 } |
166 | 169 |
| 170 // Broadcasts the mode change to all frames. |
| 171 void SetAccessibilityMode(AccessibilityMode mode); |
| 172 |
| 173 // Adds the given accessibility mode to the current accessibility mode |
| 174 // bitmap. |
| 175 void AddAccessibilityMode(AccessibilityMode mode); |
| 176 |
| 177 // Removes the given accessibility mode from the current accessibility |
| 178 // mode bitmap, managing the bits that are shared with other modes such |
| 179 // that a bit will only be turned off when all modes that depend on it |
| 180 // have been removed. |
| 181 void RemoveAccessibilityMode(AccessibilityMode mode); |
| 182 |
| 183 AccessibilityMode accessibility_mode() const { return accessibility_mode_; } |
| 184 |
167 // WebContents ------------------------------------------------------ | 185 // WebContents ------------------------------------------------------ |
168 virtual WebContentsDelegate* GetDelegate() OVERRIDE; | 186 virtual WebContentsDelegate* GetDelegate() OVERRIDE; |
169 virtual void SetDelegate(WebContentsDelegate* delegate) OVERRIDE; | 187 virtual void SetDelegate(WebContentsDelegate* delegate) OVERRIDE; |
170 virtual NavigationControllerImpl& GetController() OVERRIDE; | 188 virtual NavigationControllerImpl& GetController() OVERRIDE; |
171 virtual const NavigationControllerImpl& GetController() const OVERRIDE; | 189 virtual const NavigationControllerImpl& GetController() const OVERRIDE; |
172 virtual BrowserContext* GetBrowserContext() const OVERRIDE; | 190 virtual BrowserContext* GetBrowserContext() const OVERRIDE; |
173 virtual const GURL& GetURL() const OVERRIDE; | 191 virtual const GURL& GetURL() const OVERRIDE; |
174 virtual const GURL& GetVisibleURL() const OVERRIDE; | 192 virtual const GURL& GetVisibleURL() const OVERRIDE; |
175 virtual const GURL& GetLastCommittedURL() const OVERRIDE; | 193 virtual const GURL& GetLastCommittedURL() const OVERRIDE; |
176 virtual RenderProcessHost* GetRenderProcessHost() const OVERRIDE; | 194 virtual RenderProcessHost* GetRenderProcessHost() const OVERRIDE; |
177 virtual RenderFrameHost* GetMainFrame() OVERRIDE; | 195 virtual RenderFrameHost* GetMainFrame() OVERRIDE; |
178 virtual RenderFrameHost* GetFocusedFrame() OVERRIDE; | 196 virtual RenderFrameHost* GetFocusedFrame() OVERRIDE; |
179 virtual void ForEachFrame( | 197 virtual void ForEachFrame( |
180 const base::Callback<void(RenderFrameHost*)>& on_frame) OVERRIDE; | 198 const base::Callback<void(RenderFrameHost*)>& on_frame) OVERRIDE; |
| 199 virtual void ForEachFrameAndPendingFrame( |
| 200 const base::Callback<void(RenderFrameHost*)>& on_frame) OVERRIDE; |
181 virtual void SendToAllFrames(IPC::Message* message) OVERRIDE; | 201 virtual void SendToAllFrames(IPC::Message* message) OVERRIDE; |
182 virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; | 202 virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; |
183 virtual WebContents* GetEmbedderWebContents() const OVERRIDE; | 203 virtual WebContents* GetEmbedderWebContents() const OVERRIDE; |
184 virtual int GetEmbeddedInstanceID() const OVERRIDE; | 204 virtual int GetEmbeddedInstanceID() const OVERRIDE; |
185 virtual int GetRoutingID() const OVERRIDE; | 205 virtual int GetRoutingID() const OVERRIDE; |
186 virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE; | 206 virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE; |
187 virtual RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const | 207 virtual RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const |
188 OVERRIDE; | 208 OVERRIDE; |
189 virtual WebUI* CreateWebUI(const GURL& url) OVERRIDE; | 209 virtual WebUI* CreateWebUI(const GURL& url) OVERRIDE; |
190 virtual WebUI* GetWebUI() const OVERRIDE; | 210 virtual WebUI* GetWebUI() const OVERRIDE; |
191 virtual WebUI* GetCommittedWebUI() const OVERRIDE; | 211 virtual WebUI* GetCommittedWebUI() const OVERRIDE; |
192 virtual void SetUserAgentOverride(const std::string& override) OVERRIDE; | 212 virtual void SetUserAgentOverride(const std::string& override) OVERRIDE; |
193 virtual const std::string& GetUserAgentOverride() const OVERRIDE; | 213 virtual const std::string& GetUserAgentOverride() const OVERRIDE; |
| 214 virtual void EnableTreeOnlyAccessibilityMode() OVERRIDE; |
| 215 virtual bool IsTreeOnlyAccessibilityModeForTesting() const OVERRIDE; |
| 216 virtual bool IsFullAccessibilityModeForTesting() const OVERRIDE; |
194 #if defined(OS_WIN) | 217 #if defined(OS_WIN) |
195 virtual void SetParentNativeViewAccessible( | 218 virtual void SetParentNativeViewAccessible( |
196 gfx::NativeViewAccessible accessible_parent) OVERRIDE; | 219 gfx::NativeViewAccessible accessible_parent) OVERRIDE; |
197 #endif | 220 #endif |
198 virtual const base::string16& GetTitle() const OVERRIDE; | 221 virtual const base::string16& GetTitle() const OVERRIDE; |
199 virtual int32 GetMaxPageID() OVERRIDE; | 222 virtual int32 GetMaxPageID() OVERRIDE; |
200 virtual int32 GetMaxPageIDForSiteInstance( | 223 virtual int32 GetMaxPageIDForSiteInstance( |
201 SiteInstance* site_instance) OVERRIDE; | 224 SiteInstance* site_instance) OVERRIDE; |
202 virtual SiteInstance* GetSiteInstance() const OVERRIDE; | 225 virtual SiteInstance* GetSiteInstance() const OVERRIDE; |
203 virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE; | 226 virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 virtual void DocumentOnLoadCompleted( | 371 virtual void DocumentOnLoadCompleted( |
349 RenderFrameHost* render_frame_host) OVERRIDE; | 372 RenderFrameHost* render_frame_host) OVERRIDE; |
350 virtual void UpdateTitle(RenderFrameHost* render_frame_host, | 373 virtual void UpdateTitle(RenderFrameHost* render_frame_host, |
351 int32 page_id, | 374 int32 page_id, |
352 const base::string16& title, | 375 const base::string16& title, |
353 base::i18n::TextDirection title_direction) OVERRIDE; | 376 base::i18n::TextDirection title_direction) OVERRIDE; |
354 virtual void UpdateEncoding(RenderFrameHost* render_frame_host, | 377 virtual void UpdateEncoding(RenderFrameHost* render_frame_host, |
355 const std::string& encoding) OVERRIDE; | 378 const std::string& encoding) OVERRIDE; |
356 virtual WebContents* GetAsWebContents() OVERRIDE; | 379 virtual WebContents* GetAsWebContents() OVERRIDE; |
357 virtual bool IsNeverVisible() OVERRIDE; | 380 virtual bool IsNeverVisible() OVERRIDE; |
| 381 virtual AccessibilityMode GetAccessibilityMode() const OVERRIDE; |
| 382 virtual void AccessibilityEventReceived( |
| 383 const std::vector<AXEventNotificationDetails>& details) OVERRIDE; |
| 384 #if defined(OS_WIN) |
| 385 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE; |
| 386 #endif |
358 | 387 |
359 // RenderViewHostDelegate ---------------------------------------------------- | 388 // RenderViewHostDelegate ---------------------------------------------------- |
360 virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE; | 389 virtual RenderViewHostDelegateView* GetDelegateView() OVERRIDE; |
361 virtual bool OnMessageReceived(RenderViewHost* render_view_host, | 390 virtual bool OnMessageReceived(RenderViewHost* render_view_host, |
362 const IPC::Message& message) OVERRIDE; | 391 const IPC::Message& message) OVERRIDE; |
363 // RenderFrameHostDelegate has the same method, so list it there because this | 392 // RenderFrameHostDelegate has the same method, so list it there because this |
364 // interface is going away. | 393 // interface is going away. |
365 // virtual WebContents* GetAsWebContents() OVERRIDE; | 394 // virtual WebContents* GetAsWebContents() OVERRIDE; |
366 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; | 395 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; |
367 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; | 396 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 bool user_gesture) OVERRIDE; | 465 bool user_gesture) OVERRIDE; |
437 virtual void ShowCreatedWidget(int route_id, | 466 virtual void ShowCreatedWidget(int route_id, |
438 const gfx::Rect& initial_pos) OVERRIDE; | 467 const gfx::Rect& initial_pos) OVERRIDE; |
439 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; | 468 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; |
440 virtual void RequestMediaAccessPermission( | 469 virtual void RequestMediaAccessPermission( |
441 const MediaStreamRequest& request, | 470 const MediaStreamRequest& request, |
442 const MediaResponseCallback& callback) OVERRIDE; | 471 const MediaResponseCallback& callback) OVERRIDE; |
443 virtual SessionStorageNamespace* GetSessionStorageNamespace( | 472 virtual SessionStorageNamespace* GetSessionStorageNamespace( |
444 SiteInstance* instance) OVERRIDE; | 473 SiteInstance* instance) OVERRIDE; |
445 virtual FrameTree* GetFrameTree() OVERRIDE; | 474 virtual FrameTree* GetFrameTree() OVERRIDE; |
446 virtual void AccessibilityEventReceived( | |
447 const std::vector<AXEventNotificationDetails>& details) OVERRIDE; | |
448 | 475 |
449 // NavigatorDelegate --------------------------------------------------------- | 476 // NavigatorDelegate --------------------------------------------------------- |
450 | 477 |
451 virtual void DidStartProvisionalLoad( | 478 virtual void DidStartProvisionalLoad( |
452 RenderFrameHostImpl* render_frame_host, | 479 RenderFrameHostImpl* render_frame_host, |
453 int parent_routing_id, | 480 int parent_routing_id, |
454 const GURL& validated_url, | 481 const GURL& validated_url, |
455 bool is_error_page, | 482 bool is_error_page, |
456 bool is_iframe_srcdoc) OVERRIDE; | 483 bool is_iframe_srcdoc) OVERRIDE; |
457 virtual void DidFailProvisionalLoadWithError( | 484 virtual void DidFailProvisionalLoadWithError( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 bool* is_keyboard_shortcut) OVERRIDE; | 531 bool* is_keyboard_shortcut) OVERRIDE; |
505 virtual void HandleKeyboardEvent( | 532 virtual void HandleKeyboardEvent( |
506 const NativeWebKeyboardEvent& event) OVERRIDE; | 533 const NativeWebKeyboardEvent& event) OVERRIDE; |
507 virtual bool HandleWheelEvent( | 534 virtual bool HandleWheelEvent( |
508 const blink::WebMouseWheelEvent& event) OVERRIDE; | 535 const blink::WebMouseWheelEvent& event) OVERRIDE; |
509 virtual bool PreHandleGestureEvent( | 536 virtual bool PreHandleGestureEvent( |
510 const blink::WebGestureEvent& event) OVERRIDE; | 537 const blink::WebGestureEvent& event) OVERRIDE; |
511 virtual bool HandleGestureEvent( | 538 virtual bool HandleGestureEvent( |
512 const blink::WebGestureEvent& event) OVERRIDE; | 539 const blink::WebGestureEvent& event) OVERRIDE; |
513 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) OVERRIDE; | 540 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) OVERRIDE; |
514 #if defined(OS_WIN) | 541 virtual BrowserAccessibilityManager* GetRootBrowserAccessibilityManager() |
515 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE; | 542 OVERRIDE; |
516 #endif | |
517 | 543 |
518 // RenderFrameHostManager::Delegate ------------------------------------------ | 544 // RenderFrameHostManager::Delegate ------------------------------------------ |
519 | 545 |
520 virtual bool CreateRenderViewForRenderManager( | 546 virtual bool CreateRenderViewForRenderManager( |
521 RenderViewHost* render_view_host, | 547 RenderViewHost* render_view_host, |
522 int opener_route_id, | 548 int opener_route_id, |
523 int proxy_routing_id, | 549 int proxy_routing_id, |
524 CrossProcessFrameConnector* frame_connector) OVERRIDE; | 550 CrossProcessFrameConnector* frame_connector) OVERRIDE; |
525 virtual void BeforeUnloadFiredFromRenderManager( | 551 virtual void BeforeUnloadFiredFromRenderManager( |
526 bool proceed, const base::TimeTicks& proceed_time, | 552 bool proceed, const base::TimeTicks& proceed_time, |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 | 1119 |
1094 // Whether this WebContents is responsible for displaying a subframe in a | 1120 // Whether this WebContents is responsible for displaying a subframe in a |
1095 // different process from its parent page. | 1121 // different process from its parent page. |
1096 bool is_subframe_; | 1122 bool is_subframe_; |
1097 | 1123 |
1098 // Whether the last JavaScript dialog shown was suppressed. Used for testing. | 1124 // Whether the last JavaScript dialog shown was suppressed. Used for testing. |
1099 bool last_dialog_suppressed_; | 1125 bool last_dialog_suppressed_; |
1100 | 1126 |
1101 scoped_ptr<GeolocationDispatcherHost> geolocation_dispatcher_host_; | 1127 scoped_ptr<GeolocationDispatcherHost> geolocation_dispatcher_host_; |
1102 | 1128 |
| 1129 // The accessibility mode for all frames. This is queried when each frame |
| 1130 // is created, and broadcast to all frames when it changes. |
| 1131 AccessibilityMode accessibility_mode_; |
| 1132 |
1103 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); | 1133 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
1104 }; | 1134 }; |
1105 | 1135 |
1106 } // namespace content | 1136 } // namespace content |
1107 | 1137 |
1108 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 1138 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |