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