| 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_view_host_manager.h" | 22 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 23 #include "content/browser/renderer_host/render_view_host_delegate.h" | 23 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 24 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 24 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 25 #include "content/common/content_export.h" | 25 #include "content/common/content_export.h" |
| 26 #include "content/public/browser/notification_observer.h" | 26 #include "content/public/browser/notification_observer.h" |
| 27 #include "content/public/browser/notification_registrar.h" | 27 #include "content/public/browser/notification_registrar.h" |
| 28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/common/page_transition_types.h" | 29 #include "content/public/common/page_transition_types.h" |
| 30 #include "content/public/common/renderer_preferences.h" | 30 #include "content/public/common/renderer_preferences.h" |
| 31 #include "content/public/common/three_d_api_types.h" | 31 #include "content/public/common/three_d_api_types.h" |
| 32 #include "net/base/load_states.h" | 32 #include "net/base/load_states.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // ownership of |delegate|. | 72 // ownership of |delegate|. |
| 73 WebContentsViewPort* CreateWebContentsView( | 73 WebContentsViewPort* CreateWebContentsView( |
| 74 WebContentsImpl* web_contents, | 74 WebContentsImpl* web_contents, |
| 75 WebContentsViewDelegate* delegate, | 75 WebContentsViewDelegate* delegate, |
| 76 RenderViewHostDelegateView** render_view_host_delegate_view); | 76 RenderViewHostDelegateView** render_view_host_delegate_view); |
| 77 | 77 |
| 78 class CONTENT_EXPORT WebContentsImpl | 78 class CONTENT_EXPORT WebContentsImpl |
| 79 : public NON_EXPORTED_BASE(WebContents), | 79 : public NON_EXPORTED_BASE(WebContents), |
| 80 public RenderViewHostDelegate, | 80 public RenderViewHostDelegate, |
| 81 public RenderWidgetHostDelegate, | 81 public RenderWidgetHostDelegate, |
| 82 public RenderViewHostManager::Delegate, | 82 public RenderFrameHostManager::Delegate, |
| 83 public NotificationObserver, | 83 public NotificationObserver, |
| 84 public NON_EXPORTED_BASE(NavigationControllerDelegate), | 84 public NON_EXPORTED_BASE(NavigationControllerDelegate), |
| 85 public NON_EXPORTED_BASE(NavigatorDelegate) { | 85 public NON_EXPORTED_BASE(NavigatorDelegate) { |
| 86 public: | 86 public: |
| 87 virtual ~WebContentsImpl(); | 87 virtual ~WebContentsImpl(); |
| 88 | 88 |
| 89 static WebContentsImpl* CreateWithOpener( | 89 static WebContentsImpl* CreateWithOpener( |
| 90 const WebContents::CreateParams& params, | 90 const WebContents::CreateParams& params, |
| 91 WebContentsImpl* opener); | 91 WebContentsImpl* opener); |
| 92 | 92 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 121 | 121 |
| 122 // In Android WebView, the RenderView needs created even there is no | 122 // In Android WebView, the RenderView needs created even there is no |
| 123 // navigation entry, this allows Android WebViews to use | 123 // navigation entry, this allows Android WebViews to use |
| 124 // javascript: URLs that load into the DOMWindow before the first page | 124 // javascript: URLs that load into the DOMWindow before the first page |
| 125 // load. This is not safe to do in any context that a web page could get a | 125 // load. This is not safe to do in any context that a web page could get a |
| 126 // reference to the DOMWindow before the first page load. | 126 // reference to the DOMWindow before the first page load. |
| 127 bool CreateRenderViewForInitialEmptyDocument(); | 127 bool CreateRenderViewForInitialEmptyDocument(); |
| 128 #endif | 128 #endif |
| 129 | 129 |
| 130 // Expose the render manager for testing. | 130 // Expose the render manager for testing. |
| 131 RenderViewHostManager* GetRenderManagerForTesting(); | 131 RenderFrameHostManager* GetRenderManagerForTesting(); |
| 132 | 132 |
| 133 // Returns guest browser plugin object, or NULL if this WebContents is not a | 133 // Returns guest browser plugin object, or NULL if this WebContents is not a |
| 134 // guest. | 134 // guest. |
| 135 BrowserPluginGuest* GetBrowserPluginGuest() const; | 135 BrowserPluginGuest* GetBrowserPluginGuest() const; |
| 136 | 136 |
| 137 // Sets a BrowserPluginGuest object for this WebContents. If this WebContents | 137 // Sets a BrowserPluginGuest object for this WebContents. If this WebContents |
| 138 // has a BrowserPluginGuest then that implies that it is being hosted by | 138 // has a BrowserPluginGuest then that implies that it is being hosted by |
| 139 // a BrowserPlugin object in an embedder renderer process. | 139 // a BrowserPlugin object in an embedder renderer process. |
| 140 void SetBrowserPluginGuest(BrowserPluginGuest* guest); | 140 void SetBrowserPluginGuest(BrowserPluginGuest* guest); |
| 141 | 141 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 bool* is_keyboard_shortcut) OVERRIDE; | 436 bool* is_keyboard_shortcut) OVERRIDE; |
| 437 virtual void HandleKeyboardEvent( | 437 virtual void HandleKeyboardEvent( |
| 438 const NativeWebKeyboardEvent& event) OVERRIDE; | 438 const NativeWebKeyboardEvent& event) OVERRIDE; |
| 439 virtual bool PreHandleWheelEvent( | 439 virtual bool PreHandleWheelEvent( |
| 440 const blink::WebMouseWheelEvent& event) OVERRIDE; | 440 const blink::WebMouseWheelEvent& event) OVERRIDE; |
| 441 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) OVERRIDE; | 441 virtual void DidSendScreenRects(RenderWidgetHostImpl* rwh) OVERRIDE; |
| 442 #if defined(OS_WIN) && defined(USE_AURA) | 442 #if defined(OS_WIN) && defined(USE_AURA) |
| 443 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE; | 443 virtual gfx::NativeViewAccessible GetParentNativeViewAccessible() OVERRIDE; |
| 444 #endif | 444 #endif |
| 445 | 445 |
| 446 // RenderViewHostManager::Delegate ------------------------------------------- | 446 // RenderFrameHostManager::Delegate ------------------------------------------ |
| 447 | 447 |
| 448 virtual bool CreateRenderViewForRenderManager( | 448 virtual bool CreateRenderViewForRenderManager( |
| 449 RenderViewHost* render_view_host, int opener_route_id) OVERRIDE; | 449 RenderViewHost* render_view_host, int opener_route_id) OVERRIDE; |
| 450 virtual void BeforeUnloadFiredFromRenderManager( | 450 virtual void BeforeUnloadFiredFromRenderManager( |
| 451 bool proceed, const base::TimeTicks& proceed_time, | 451 bool proceed, const base::TimeTicks& proceed_time, |
| 452 bool* proceed_to_fire_unload) OVERRIDE; | 452 bool* proceed_to_fire_unload) OVERRIDE; |
| 453 virtual void RenderProcessGoneFromRenderManager( | 453 virtual void RenderProcessGoneFromRenderManager( |
| 454 RenderViewHost* render_view_host) OVERRIDE; | 454 RenderViewHost* render_view_host) OVERRIDE; |
| 455 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE; | 455 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE; |
| 456 virtual void CancelModalDialogsForRenderManager() OVERRIDE; | 456 virtual void CancelModalDialogsForRenderManager() OVERRIDE; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 551 |
| 552 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); | 552 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); |
| 553 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); | 553 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); |
| 554 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); | 554 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); |
| 555 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, | 555 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
| 556 CrossSiteCantPreemptAfterUnload); | 556 CrossSiteCantPreemptAfterUnload); |
| 557 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents); | 557 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContents); |
| 558 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape); | 558 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape); |
| 559 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); | 559 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); |
| 560 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); | 560 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); |
| 561 FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload); | 561 FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload); |
| 562 | 562 |
| 563 // So InterstitialPageImpl can access SetIsLoading. | 563 // So InterstitialPageImpl can access SetIsLoading. |
| 564 friend class InterstitialPageImpl; | 564 friend class InterstitialPageImpl; |
| 565 | 565 |
| 566 // TODO(brettw) TestWebContents shouldn't exist! | 566 // TODO(brettw) TestWebContents shouldn't exist! |
| 567 friend class TestWebContents; | 567 friend class TestWebContents; |
| 568 | 568 |
| 569 class DestructionObserver; | 569 class DestructionObserver; |
| 570 | 570 |
| 571 // See WebContents::Create for a description of these parameters. | 571 // See WebContents::Create for a description of these parameters. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 // Misc non-view stuff ------------------------------------------------------- | 754 // Misc non-view stuff ------------------------------------------------------- |
| 755 | 755 |
| 756 // Helper functions for sending notifications. | 756 // Helper functions for sending notifications. |
| 757 void NotifySwapped(RenderViewHost* old_host, RenderViewHost* new_host); | 757 void NotifySwapped(RenderViewHost* old_host, RenderViewHost* new_host); |
| 758 void NotifyDisconnected(); | 758 void NotifyDisconnected(); |
| 759 | 759 |
| 760 void SetEncoding(const std::string& encoding); | 760 void SetEncoding(const std::string& encoding); |
| 761 | 761 |
| 762 // TODO(creis): This should take in a FrameTreeNode to know which node's | 762 // TODO(creis): This should take in a FrameTreeNode to know which node's |
| 763 // render manager to return. For now, we just return the root's. | 763 // render manager to return. For now, we just return the root's. |
| 764 RenderViewHostManager* GetRenderManager() const; | 764 RenderFrameHostManager* GetRenderManager() const; |
| 765 | 765 |
| 766 RenderViewHostImpl* GetRenderViewHostImpl(); | 766 RenderViewHostImpl* GetRenderViewHostImpl(); |
| 767 | 767 |
| 768 // Removes browser plugin embedder if there is one. | 768 // Removes browser plugin embedder if there is one. |
| 769 void RemoveBrowserPluginEmbedder(); | 769 void RemoveBrowserPluginEmbedder(); |
| 770 | 770 |
| 771 // Clear |render_view_host|'s PowerSaveBlockers. | 771 // Clear |render_view_host|'s PowerSaveBlockers. |
| 772 void ClearPowerSaveBlockers(RenderViewHost* render_view_host); | 772 void ClearPowerSaveBlockers(RenderViewHost* render_view_host); |
| 773 | 773 |
| 774 // Clear all PowerSaveBlockers, leave power_save_blocker_ empty. | 774 // Clear all PowerSaveBlockers, leave power_save_blocker_ empty. |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 // Maps the ids of pending image downloads to their callbacks | 985 // Maps the ids of pending image downloads to their callbacks |
| 986 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; | 986 typedef std::map<int, ImageDownloadCallback> ImageDownloadMap; |
| 987 ImageDownloadMap image_download_map_; | 987 ImageDownloadMap image_download_map_; |
| 988 | 988 |
| 989 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); | 989 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
| 990 }; | 990 }; |
| 991 | 991 |
| 992 } // namespace content | 992 } // namespace content |
| 993 | 993 |
| 994 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ | 994 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| OLD | NEW |