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.h" | |
22 #include "content/browser/frame_host/navigator_delegate.h" | |
21 #include "content/browser/frame_host/render_view_host_manager.h" | 23 #include "content/browser/frame_host/render_view_host_manager.h" |
22 #include "content/browser/renderer_host/render_view_host_delegate.h" | 24 #include "content/browser/renderer_host/render_view_host_delegate.h" |
23 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 25 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
24 #include "content/common/content_export.h" | 26 #include "content/common/content_export.h" |
25 #include "content/public/browser/notification_observer.h" | 27 #include "content/public/browser/notification_observer.h" |
26 #include "content/public/browser/notification_registrar.h" | 28 #include "content/public/browser/notification_registrar.h" |
27 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
28 #include "content/public/common/page_transition_types.h" | 30 #include "content/public/common/page_transition_types.h" |
29 #include "content/public/common/renderer_preferences.h" | 31 #include "content/public/common/renderer_preferences.h" |
30 #include "content/public/common/three_d_api_types.h" | 32 #include "content/public/common/three_d_api_types.h" |
(...skipping 11 matching lines...) Expand all Loading... | |
42 class BrowserPluginEmbedder; | 44 class BrowserPluginEmbedder; |
43 class BrowserPluginGuest; | 45 class BrowserPluginGuest; |
44 class BrowserPluginGuestManager; | 46 class BrowserPluginGuestManager; |
45 class ColorChooser; | 47 class ColorChooser; |
46 class DateTimeChooserAndroid; | 48 class DateTimeChooserAndroid; |
47 class DownloadItem; | 49 class DownloadItem; |
48 class InterstitialPageImpl; | 50 class InterstitialPageImpl; |
49 class JavaBridgeDispatcherHostManager; | 51 class JavaBridgeDispatcherHostManager; |
50 class JavaScriptDialogManager; | 52 class JavaScriptDialogManager; |
51 class PowerSaveBlocker; | 53 class PowerSaveBlocker; |
54 class RenderFrameHost; | |
52 class RenderViewHost; | 55 class RenderViewHost; |
53 class RenderViewHostDelegateView; | 56 class RenderViewHostDelegateView; |
54 class RenderViewHostImpl; | 57 class RenderViewHostImpl; |
55 class RenderWidgetHostImpl; | 58 class RenderWidgetHostImpl; |
56 class RenderWidgetHostViewPort; | 59 class RenderWidgetHostViewPort; |
57 class SavePackage; | 60 class SavePackage; |
58 class SessionStorageNamespaceImpl; | 61 class SessionStorageNamespaceImpl; |
59 class SiteInstance; | 62 class SiteInstance; |
60 class TestWebContents; | 63 class TestWebContents; |
61 class WebContentsDelegate; | 64 class WebContentsDelegate; |
(...skipping 10 matching lines...) Expand all Loading... | |
72 WebContentsImpl* web_contents, | 75 WebContentsImpl* web_contents, |
73 WebContentsViewDelegate* delegate, | 76 WebContentsViewDelegate* delegate, |
74 RenderViewHostDelegateView** render_view_host_delegate_view); | 77 RenderViewHostDelegateView** render_view_host_delegate_view); |
75 | 78 |
76 class CONTENT_EXPORT WebContentsImpl | 79 class CONTENT_EXPORT WebContentsImpl |
77 : public NON_EXPORTED_BASE(WebContents), | 80 : public NON_EXPORTED_BASE(WebContents), |
78 public RenderViewHostDelegate, | 81 public RenderViewHostDelegate, |
79 public RenderWidgetHostDelegate, | 82 public RenderWidgetHostDelegate, |
80 public RenderViewHostManager::Delegate, | 83 public RenderViewHostManager::Delegate, |
81 public NotificationObserver, | 84 public NotificationObserver, |
82 public NON_EXPORTED_BASE(NavigationControllerDelegate) { | 85 public NON_EXPORTED_BASE(NavigationControllerDelegate), |
86 public NON_EXPORTED_BASE(NavigatorDelegate) { | |
83 public: | 87 public: |
84 virtual ~WebContentsImpl(); | 88 virtual ~WebContentsImpl(); |
85 | 89 |
86 static WebContentsImpl* CreateWithOpener( | 90 static WebContentsImpl* CreateWithOpener( |
87 const WebContents::CreateParams& params, | 91 const WebContents::CreateParams& params, |
88 WebContentsImpl* opener); | 92 WebContentsImpl* opener); |
89 | 93 |
90 // Returns the opener WebContentsImpl, if any. This can be set to null if the | 94 // Returns the opener WebContentsImpl, if any. This can be set to null if the |
91 // opener is closed or the page clears its window.opener. | 95 // opener is closed or the page clears its window.opener. |
92 WebContentsImpl* opener() const { return opener_; } | 96 WebContentsImpl* opener() const { return opener_; } |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 virtual const GURL& GetVisibleURL() const OVERRIDE; | 284 virtual const GURL& GetVisibleURL() const OVERRIDE; |
281 virtual const GURL& GetLastCommittedURL() const OVERRIDE; | 285 virtual const GURL& GetLastCommittedURL() const OVERRIDE; |
282 virtual WebContents* GetAsWebContents() OVERRIDE; | 286 virtual WebContents* GetAsWebContents() OVERRIDE; |
283 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; | 287 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; |
284 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; | 288 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; |
285 virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE; | 289 virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE; |
286 virtual void RenderViewTerminated(RenderViewHost* render_view_host, | 290 virtual void RenderViewTerminated(RenderViewHost* render_view_host, |
287 base::TerminationStatus status, | 291 base::TerminationStatus status, |
288 int error_code) OVERRIDE; | 292 int error_code) OVERRIDE; |
289 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; | 293 virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; |
290 virtual void DidStartProvisionalLoadForFrame( | |
291 RenderViewHost* render_view_host, | |
292 int64 frame_id, | |
293 int64 parent_frame_id, | |
294 bool main_frame, | |
295 const GURL& url) OVERRIDE; | |
296 virtual void DidRedirectProvisionalLoad( | 294 virtual void DidRedirectProvisionalLoad( |
297 RenderViewHost* render_view_host, | 295 RenderViewHost* render_view_host, |
298 int32 page_id, | 296 int32 page_id, |
299 const GURL& source_url, | 297 const GURL& source_url, |
300 const GURL& target_url) OVERRIDE; | 298 const GURL& target_url) OVERRIDE; |
301 virtual void DidFailProvisionalLoadWithError( | 299 virtual void DidFailProvisionalLoadWithError( |
302 RenderViewHost* render_view_host, | 300 RenderViewHost* render_view_host, |
303 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) | 301 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) |
304 OVERRIDE; | 302 OVERRIDE; |
305 virtual void DidGetResourceResponseStart( | 303 virtual void DidGetResourceResponseStart( |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 const gfx::Rect& initial_pos) OVERRIDE; | 415 const gfx::Rect& initial_pos) OVERRIDE; |
418 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; | 416 virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; |
419 virtual void ShowContextMenu(const ContextMenuParams& params) OVERRIDE; | 417 virtual void ShowContextMenu(const ContextMenuParams& params) OVERRIDE; |
420 virtual void RequestMediaAccessPermission( | 418 virtual void RequestMediaAccessPermission( |
421 const MediaStreamRequest& request, | 419 const MediaStreamRequest& request, |
422 const MediaResponseCallback& callback) OVERRIDE; | 420 const MediaResponseCallback& callback) OVERRIDE; |
423 virtual SessionStorageNamespace* GetSessionStorageNamespace( | 421 virtual SessionStorageNamespace* GetSessionStorageNamespace( |
424 SiteInstance* instance) OVERRIDE; | 422 SiteInstance* instance) OVERRIDE; |
425 virtual FrameTree* GetFrameTree() OVERRIDE; | 423 virtual FrameTree* GetFrameTree() OVERRIDE; |
426 | 424 |
425 // NavigatorDelegate --------------------------------------------------------- | |
426 | |
427 virtual void DidStartProvisionalLoad( | |
428 int64 frame_id, | |
429 int64 parent_frame_id, | |
430 bool is_main_frame, | |
431 const GURL& validated_url, | |
432 bool is_error_page, | |
433 bool is_iframe_srcdoc, | |
434 RenderFrameHost* render_frame_host) OVERRIDE; | |
Charlie Reis
2013/11/07 01:22:43
Since every one of these should take in the RFH, l
| |
435 | |
436 virtual void ProvisionalChangeToMainFrameUrl( | |
437 const GURL& url, | |
438 RenderFrameHost* render_frame_host) OVERRIDE; | |
439 | |
427 // RenderWidgetHostDelegate -------------------------------------------------- | 440 // RenderWidgetHostDelegate -------------------------------------------------- |
428 | 441 |
429 virtual void RenderWidgetDeleted( | 442 virtual void RenderWidgetDeleted( |
430 RenderWidgetHostImpl* render_widget_host) OVERRIDE; | 443 RenderWidgetHostImpl* render_widget_host) OVERRIDE; |
431 virtual bool PreHandleKeyboardEvent( | 444 virtual bool PreHandleKeyboardEvent( |
432 const NativeWebKeyboardEvent& event, | 445 const NativeWebKeyboardEvent& event, |
433 bool* is_keyboard_shortcut) OVERRIDE; | 446 bool* is_keyboard_shortcut) OVERRIDE; |
434 virtual void HandleKeyboardEvent( | 447 virtual void HandleKeyboardEvent( |
435 const NativeWebKeyboardEvent& event) OVERRIDE; | 448 const NativeWebKeyboardEvent& event) OVERRIDE; |
436 virtual bool PreHandleWheelEvent( | 449 virtual bool PreHandleWheelEvent( |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
531 // Unsets the currently showing interstitial. | 544 // Unsets the currently showing interstitial. |
532 virtual void DetachInterstitialPage() OVERRIDE; | 545 virtual void DetachInterstitialPage() OVERRIDE; |
533 | 546 |
534 // Changes the IsLoading state and notifies the delegate as needed. | 547 // Changes the IsLoading state and notifies the delegate as needed. |
535 // |details| is used to provide details on the load that just finished | 548 // |details| is used to provide details on the load that just finished |
536 // (but can be null if not applicable). | 549 // (but can be null if not applicable). |
537 virtual void SetIsLoading(RenderViewHost* render_view_host, | 550 virtual void SetIsLoading(RenderViewHost* render_view_host, |
538 bool is_loading, | 551 bool is_loading, |
539 LoadNotificationDetails* details) OVERRIDE; | 552 LoadNotificationDetails* details) OVERRIDE; |
540 | 553 |
541 | |
542 private: | 554 private: |
543 friend class NavigationControllerImpl; | 555 friend class NavigationControllerImpl; |
544 friend class WebContentsObserver; | 556 friend class WebContentsObserver; |
545 friend class WebContents; // To implement factory methods. | 557 friend class WebContents; // To implement factory methods. |
546 | 558 |
547 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); | 559 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); |
548 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); | 560 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); |
549 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); | 561 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); |
550 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, | 562 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
551 CrossSiteCantPreemptAfterUnload); | 563 CrossSiteCantPreemptAfterUnload); |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
819 // Maps the RenderViewHost to its media_player_cookie and PowerSaveBlocker | 831 // Maps the RenderViewHost to its media_player_cookie and PowerSaveBlocker |
820 // pairs. Key is the RenderViewHost, value is the map which maps player_cookie | 832 // pairs. Key is the RenderViewHost, value is the map which maps player_cookie |
821 // on to PowerSaveBlocker. | 833 // on to PowerSaveBlocker. |
822 typedef std::map<RenderViewHost*, std::map<int64, PowerSaveBlocker*> > | 834 typedef std::map<RenderViewHost*, std::map<int64, PowerSaveBlocker*> > |
823 PowerSaveBlockerMap; | 835 PowerSaveBlockerMap; |
824 PowerSaveBlockerMap power_save_blockers_; | 836 PowerSaveBlockerMap power_save_blockers_; |
825 | 837 |
826 // Manages creation and swapping of render views. | 838 // Manages creation and swapping of render views. |
827 RenderViewHostManager render_manager_; | 839 RenderViewHostManager render_manager_; |
828 | 840 |
829 // The frame tree structure of the current page. | 841 // The frame tree hierarchy of the current page. |
830 FrameTree frame_tree_; | 842 FrameTree frame_tree_; |
831 | 843 |
832 #if defined(OS_ANDROID) | 844 #if defined(OS_ANDROID) |
833 // Manages injecting Java objects into all RenderViewHosts associated with | 845 // Manages injecting Java objects into all RenderViewHosts associated with |
834 // this WebContentsImpl. | 846 // this WebContentsImpl. |
835 scoped_ptr<JavaBridgeDispatcherHostManager> | 847 scoped_ptr<JavaBridgeDispatcherHostManager> |
836 java_bridge_dispatcher_host_manager_; | 848 java_bridge_dispatcher_host_manager_; |
837 #endif | 849 #endif |
838 | 850 |
839 // SavePackage, lazily created. | 851 // SavePackage, lazily created. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
975 // Maps the ids of pending image downloads to their callbacks | 987 // Maps the ids of pending image downloads to their callbacks |
976 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; | 988 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; |
977 ImageDownloadMap image_download_map_; | 989 ImageDownloadMap image_download_map_; |
978 | 990 |
979 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); | 991 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
980 }; | 992 }; |
981 | 993 |
982 } // namespace content | 994 } // namespace content |
983 | 995 |
984 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 996 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
OLD | NEW |