| 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/renderer_host/frame_tree.h" | 18 #include "content/browser/renderer_host/frame_tree.h" |
| 19 #include "content/browser/renderer_host/navigator_observer.h" |
| 19 #include "content/browser/renderer_host/render_view_host_delegate.h" | 20 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 20 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 21 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 21 #include "content/browser/web_contents/navigation_controller_impl.h" | 22 #include "content/browser/web_contents/navigation_controller_impl.h" |
| 22 #include "content/browser/web_contents/render_view_host_manager.h" | 23 #include "content/browser/web_contents/render_view_host_manager.h" |
| 23 #include "content/common/content_export.h" | 24 #include "content/common/content_export.h" |
| 24 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
| 25 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
| 26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/common/renderer_preferences.h" | 28 #include "content/public/common/renderer_preferences.h" |
| 28 #include "content/public/common/three_d_api_types.h" | 29 #include "content/public/common/three_d_api_types.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 41 class BrowserPluginEmbedder; | 42 class BrowserPluginEmbedder; |
| 42 class BrowserPluginGuest; | 43 class BrowserPluginGuest; |
| 43 class BrowserPluginGuestManager; | 44 class BrowserPluginGuestManager; |
| 44 class ColorChooser; | 45 class ColorChooser; |
| 45 class DateTimeChooserAndroid; | 46 class DateTimeChooserAndroid; |
| 46 class DownloadItem; | 47 class DownloadItem; |
| 47 class InterstitialPageImpl; | 48 class InterstitialPageImpl; |
| 48 class JavaBridgeDispatcherHostManager; | 49 class JavaBridgeDispatcherHostManager; |
| 49 class JavaScriptDialogManager; | 50 class JavaScriptDialogManager; |
| 50 class PowerSaveBlocker; | 51 class PowerSaveBlocker; |
| 52 class RenderFrameHost; |
| 51 class RenderViewHost; | 53 class RenderViewHost; |
| 52 class RenderViewHostDelegateView; | 54 class RenderViewHostDelegateView; |
| 53 class RenderViewHostImpl; | 55 class RenderViewHostImpl; |
| 54 class RenderWidgetHostImpl; | 56 class RenderWidgetHostImpl; |
| 55 class RenderWidgetHostViewPort; | 57 class RenderWidgetHostViewPort; |
| 56 class SavePackage; | 58 class SavePackage; |
| 57 class SessionStorageNamespaceImpl; | 59 class SessionStorageNamespaceImpl; |
| 58 class SiteInstance; | 60 class SiteInstance; |
| 59 class TestWebContents; | 61 class TestWebContents; |
| 60 class WebContentsDelegate; | 62 class WebContentsDelegate; |
| 61 class WebContentsImpl; | 63 class WebContentsImpl; |
| 62 class WebContentsObserver; | 64 class WebContentsObserver; |
| 63 class WebContentsViewPort; | 65 class WebContentsViewPort; |
| 64 class WebContentsViewDelegate; | 66 class WebContentsViewDelegate; |
| 65 struct FaviconURL; | 67 struct FaviconURL; |
| 66 struct LoadNotificationDetails; | 68 struct LoadNotificationDetails; |
| 67 | 69 |
| 68 // Factory function for the implementations that content knows about. Takes | 70 // Factory function for the implementations that content knows about. Takes |
| 69 // ownership of |delegate|. | 71 // ownership of |delegate|. |
| 70 WebContentsViewPort* CreateWebContentsView( | 72 WebContentsViewPort* CreateWebContentsView( |
| 71 WebContentsImpl* web_contents, | 73 WebContentsImpl* web_contents, |
| 72 WebContentsViewDelegate* delegate, | 74 WebContentsViewDelegate* delegate, |
| 73 RenderViewHostDelegateView** render_view_host_delegate_view); | 75 RenderViewHostDelegateView** render_view_host_delegate_view); |
| 74 | 76 |
| 75 class CONTENT_EXPORT WebContentsImpl | 77 class CONTENT_EXPORT WebContentsImpl |
| 76 : public NON_EXPORTED_BASE(WebContents), | 78 : public NON_EXPORTED_BASE(WebContents), |
| 77 public RenderViewHostDelegate, | 79 public RenderViewHostDelegate, |
| 78 public RenderWidgetHostDelegate, | 80 public RenderWidgetHostDelegate, |
| 79 public RenderViewHostManager::Delegate, | 81 public RenderViewHostManager::Delegate, |
| 80 public NotificationObserver { | 82 public NotificationObserver, |
| 83 public NavigatorObserver { |
| 81 public: | 84 public: |
| 82 virtual ~WebContentsImpl(); | 85 virtual ~WebContentsImpl(); |
| 83 | 86 |
| 84 static WebContentsImpl* CreateWithOpener( | 87 static WebContentsImpl* CreateWithOpener( |
| 85 const WebContents::CreateParams& params, | 88 const WebContents::CreateParams& params, |
| 86 WebContentsImpl* opener); | 89 WebContentsImpl* opener); |
| 87 | 90 |
| 88 // Returns the opener WebContentsImpl, if any. This can be set to null if the | 91 // Returns the opener WebContentsImpl, if any. This can be set to null if the |
| 89 // opener is closed or the page clears its window.opener. | 92 // opener is closed or the page clears its window.opener. |
| 90 WebContentsImpl* opener() const { return opener_; } | 93 WebContentsImpl* opener() const { return opener_; } |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 virtual const GURL& GetVisibleURL() const OVERRIDE; | 325 virtual const GURL& GetVisibleURL() const OVERRIDE; |
| 323 virtual const GURL& GetLastCommittedURL() const OVERRIDE; | 326 virtual const GURL& GetLastCommittedURL() const OVERRIDE; |
| 324 virtual WebContents* GetAsWebContents() OVERRIDE; | 327 virtual WebContents* GetAsWebContents() OVERRIDE; |
| 325 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; | 328 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; |
| 326 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; | 329 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; |
| 327 virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE; | 330 virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE; |
| 328 virtual void RenderViewTerminated(RenderViewHost* render_view_host, | 331 virtual void RenderViewTerminated(RenderViewHost* render_view_host, |
| 329 base::TerminationStatus status, | 332 base::TerminationStatus status, |
| 330 int error_code) OVERRIDE; | 333 int error_code) OVERRIDE; |
| 331 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; | 334 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; |
| 332 virtual void DidStartProvisionalLoadForFrame( | |
| 333 RenderViewHost* render_view_host, | |
| 334 int64 frame_id, | |
| 335 int64 parent_frame_id, | |
| 336 bool main_frame, | |
| 337 const GURL& url) OVERRIDE; | |
| 338 virtual void DidRedirectProvisionalLoad( | 335 virtual void DidRedirectProvisionalLoad( |
| 339 RenderViewHost* render_view_host, | 336 RenderViewHost* render_view_host, |
| 340 int32 page_id, | 337 int32 page_id, |
| 341 const GURL& source_url, | 338 const GURL& source_url, |
| 342 const GURL& target_url) OVERRIDE; | 339 const GURL& target_url) OVERRIDE; |
| 343 virtual void DidFailProvisionalLoadWithError( | 340 virtual void DidFailProvisionalLoadWithError( |
| 344 RenderViewHost* render_view_host, | 341 RenderViewHost* render_view_host, |
| 345 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) | 342 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) |
| 346 OVERRIDE; | 343 OVERRIDE; |
| 347 virtual void DidGetResourceResponseStart( | 344 virtual void DidGetResourceResponseStart( |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 const gfx::Rect& initial_pos) OVERRIDE; | 454 const gfx::Rect& initial_pos) OVERRIDE; |
| 458 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; | 455 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; |
| 459 virtual void ShowContextMenu(const ContextMenuParams& params) OVERRIDE; | 456 virtual void ShowContextMenu(const ContextMenuParams& params) OVERRIDE; |
| 460 virtual void RequestMediaAccessPermission( | 457 virtual void RequestMediaAccessPermission( |
| 461 const MediaStreamRequest& request, | 458 const MediaStreamRequest& request, |
| 462 const MediaResponseCallback& callback) OVERRIDE; | 459 const MediaResponseCallback& callback) OVERRIDE; |
| 463 virtual SessionStorageNamespace* GetSessionStorageNamespace( | 460 virtual SessionStorageNamespace* GetSessionStorageNamespace( |
| 464 SiteInstance* instance) OVERRIDE; | 461 SiteInstance* instance) OVERRIDE; |
| 465 virtual FrameTree* GetFrameTree() OVERRIDE; | 462 virtual FrameTree* GetFrameTree() OVERRIDE; |
| 466 | 463 |
| 464 // NavigatorObserver -------------------------------------------------------- |
| 465 virtual void DidStartProvisionalLoad( |
| 466 int64 frame_id, |
| 467 int64 parent_frame_id, |
| 468 bool is_main_frame, |
| 469 const GURL& validated_url, |
| 470 bool is_error_page, |
| 471 bool is_iframe_srcdoc, |
| 472 RenderFrameHost* render_frame_host) OVERRIDE; |
| 473 |
| 474 virtual void ProvisionalChangeToMainFrameUrl( |
| 475 const GURL& url, |
| 476 RenderFrameHost* render_frame_host) OVERRIDE; |
| 477 |
| 467 // RenderWidgetHostDelegate -------------------------------------------------- | 478 // RenderWidgetHostDelegate -------------------------------------------------- |
| 468 | 479 |
| 469 virtual void RenderWidgetDeleted( | 480 virtual void RenderWidgetDeleted( |
| 470 RenderWidgetHostImpl* render_widget_host) OVERRIDE; | 481 RenderWidgetHostImpl* render_widget_host) OVERRIDE; |
| 471 virtual bool PreHandleKeyboardEvent( | 482 virtual bool PreHandleKeyboardEvent( |
| 472 const NativeWebKeyboardEvent& event, | 483 const NativeWebKeyboardEvent& event, |
| 473 bool* is_keyboard_shortcut) OVERRIDE; | 484 bool* is_keyboard_shortcut) OVERRIDE; |
| 474 virtual void HandleKeyboardEvent( | 485 virtual void HandleKeyboardEvent( |
| 475 const NativeWebKeyboardEvent& event) OVERRIDE; | 486 const NativeWebKeyboardEvent& event) OVERRIDE; |
| 476 virtual bool PreHandleWheelEvent( | 487 virtual bool PreHandleWheelEvent( |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 // Maps the RenderViewHost to its media_player_cookie and PowerSaveBlocker | 820 // Maps the RenderViewHost to its media_player_cookie and PowerSaveBlocker |
| 810 // pairs. Key is the RenderViewHost, value is the map which maps player_cookie | 821 // pairs. Key is the RenderViewHost, value is the map which maps player_cookie |
| 811 // on to PowerSaveBlocker. | 822 // on to PowerSaveBlocker. |
| 812 typedef std::map<RenderViewHost*, std::map<int64, PowerSaveBlocker*> > | 823 typedef std::map<RenderViewHost*, std::map<int64, PowerSaveBlocker*> > |
| 813 PowerSaveBlockerMap; | 824 PowerSaveBlockerMap; |
| 814 PowerSaveBlockerMap power_save_blockers_; | 825 PowerSaveBlockerMap power_save_blockers_; |
| 815 | 826 |
| 816 // Manages creation and swapping of render views. | 827 // Manages creation and swapping of render views. |
| 817 RenderViewHostManager render_manager_; | 828 RenderViewHostManager render_manager_; |
| 818 | 829 |
| 819 // The frame tree structure of the current page. | 830 // The frame tree hierarchy of the current page. |
| 820 FrameTree frame_tree_; | 831 FrameTree frame_tree_; |
| 821 | 832 |
| 822 #if defined(OS_ANDROID) | 833 #if defined(OS_ANDROID) |
| 823 // Manages injecting Java objects into all RenderViewHosts associated with | 834 // Manages injecting Java objects into all RenderViewHosts associated with |
| 824 // this WebContentsImpl. | 835 // this WebContentsImpl. |
| 825 scoped_ptr<JavaBridgeDispatcherHostManager> | 836 scoped_ptr<JavaBridgeDispatcherHostManager> |
| 826 java_bridge_dispatcher_host_manager_; | 837 java_bridge_dispatcher_host_manager_; |
| 827 #endif | 838 #endif |
| 828 | 839 |
| 829 // SavePackage, lazily created. | 840 // SavePackage, lazily created. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 // Maps the ids of pending image downloads to their callbacks | 976 // Maps the ids of pending image downloads to their callbacks |
| 966 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; | 977 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; |
| 967 ImageDownloadMap image_download_map_; | 978 ImageDownloadMap image_download_map_; |
| 968 | 979 |
| 969 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); | 980 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
| 970 }; | 981 }; |
| 971 | 982 |
| 972 } // namespace content | 983 } // namespace content |
| 973 | 984 |
| 974 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 985 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| OLD | NEW |