[email protected] | 91854cd | 2012-01-10 19:43:57 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 93ddb3c | 2012-04-11 21:44:29 | [diff] [blame] | 5 | #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| 6 | #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 7 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 8 | #include <map> |
| 9 | #include <string> |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 10 | |
[email protected] | 01d6517 | 2011-12-25 04:39:30 | [diff] [blame] | 11 | #include "base/compiler_specific.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 12 | #include "base/gtest_prod_util.h" |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 13 | #include "base/memory/scoped_ptr.h" |
[email protected] | 6eac57a | 2011-07-12 21:15:09 | [diff] [blame] | 14 | #include "base/observer_list.h" |
[email protected] | 45644f6 | 2011-11-23 00:58:23 | [diff] [blame] | 15 | #include "base/property_bag.h" |
[email protected] | cc510d7e | 2012-08-08 04:40:10 | [diff] [blame] | 16 | #include "content/browser/browser_plugin/old/old_browser_plugin_host.h" |
[email protected] | 0716190 | 2011-11-11 09:57:42 | [diff] [blame] | 17 | #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.h" |
[email protected] | 2e3bf99 | 2012-05-24 17:36:24 | [diff] [blame] | 18 | #include "content/browser/renderer_host/render_view_host_delegate.h" |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 19 | #include "content/browser/renderer_host/render_widget_host_delegate.h" |
[email protected] | f9e4dae | 2012-04-10 21:26:37 | [diff] [blame] | 20 | #include "content/browser/web_contents/navigation_controller_impl.h" |
[email protected] | 0c4e92e6 | 2012-04-11 15:19:00 | [diff] [blame] | 21 | #include "content/browser/web_contents/render_view_host_manager.h" |
[email protected] | 8d128d6 | 2011-09-13 22:11:57 | [diff] [blame] | 22 | #include "content/common/content_export.h" |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 23 | #include "content/public/browser/notification_observer.h" |
| 24 | #include "content/public/browser/notification_registrar.h" |
[email protected] | 58f5d56 | 2011-12-20 17:13:03 | [diff] [blame] | 25 | #include "content/public/browser/web_contents.h" |
[email protected] | daf82f8 | 2011-10-31 22:35:31 | [diff] [blame] | 26 | #include "content/public/common/renderer_preferences.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 27 | #include "net/base/load_states.h" |
[email protected] | bcd281560 | 2012-01-14 18:17:23 | [diff] [blame] | 28 | #include "ui/gfx/size.h" |
[email protected] | 7043596 | 2011-08-02 20:13:28 | [diff] [blame] | 29 | #include "webkit/glue/resource_type.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 30 | |
| 31 | #if defined(OS_WIN) |
| 32 | #include "base/win/scoped_handle.h" |
| 33 | #endif |
| 34 | |
[email protected] | cadaec5 | 2012-02-08 21:53:13 | [diff] [blame] | 35 | class InterstitialPageImpl; |
[email protected] | a53209b | 2012-01-20 16:48:16 | [diff] [blame] | 36 | class SavePackage; |
[email protected] | adbfb8df | 2012-02-24 01:19:43 | [diff] [blame] | 37 | class SessionStorageNamespaceImpl; |
[email protected] | f66df82 | 2012-05-18 16:52:17 | [diff] [blame] | 38 | class WebContentsImpl; |
[email protected] | f546640b | 2012-05-15 00:03:49 | [diff] [blame] | 39 | struct ViewMsg_PostMessage_Params; |
[email protected] | daf82f8 | 2011-10-31 22:35:31 | [diff] [blame] | 40 | |
[email protected] | e582fdd | 2011-12-20 16:48:17 | [diff] [blame] | 41 | namespace content { |
[email protected] | da854376 | 2012-03-20 08:52:20 | [diff] [blame] | 42 | class ColorChooser; |
[email protected] | e582fdd | 2011-12-20 16:48:17 | [diff] [blame] | 43 | class DownloadItem; |
[email protected] | 51da7e3 | 2012-01-30 19:24:52 | [diff] [blame] | 44 | class JavaScriptDialogCreator; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 45 | class RenderViewHost; |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 46 | class RenderViewHostDelegateView; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 47 | class RenderViewHostImpl; |
[email protected] | 09d31d5 | 2012-03-11 22:30:27 | [diff] [blame] | 48 | class SiteInstance; |
[email protected] | 80e776ae | 2012-03-23 16:17:20 | [diff] [blame] | 49 | class TestWebContents; |
[email protected] | 674bc59 | 2011-12-20 23:00:42 | [diff] [blame] | 50 | class WebContentsDelegate; |
[email protected] | 51da7e3 | 2012-01-30 19:24:52 | [diff] [blame] | 51 | class WebContentsObserver; |
[email protected] | 8643e6d | 2012-01-18 20:26:10 | [diff] [blame] | 52 | class WebContentsView; |
[email protected] | f66df82 | 2012-05-18 16:52:17 | [diff] [blame] | 53 | class WebContentsViewDelegate; |
[email protected] | 09d31d5 | 2012-03-11 22:30:27 | [diff] [blame] | 54 | struct LoadNotificationDetails; |
[email protected] | f66df82 | 2012-05-18 16:52:17 | [diff] [blame] | 55 | |
| 56 | // Factory function for the implementations that content knows about. Takes |
| 57 | // ownership of |delegate|. |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 58 | WebContentsView* CreateWebContentsView( |
| 59 | WebContentsImpl* web_contents, |
| 60 | WebContentsViewDelegate* delegate, |
| 61 | RenderViewHostDelegateView** render_view_host_delegate_view); |
[email protected] | 97714c8 | 2012-06-06 10:15:13 | [diff] [blame] | 62 | |
| 63 | } // namespace content |
[email protected] | e582fdd | 2011-12-20 16:48:17 | [diff] [blame] | 64 | |
[email protected] | daf82f8 | 2011-10-31 22:35:31 | [diff] [blame] | 65 | namespace webkit_glue { |
| 66 | struct WebIntentData; |
[email protected] | 3a3b75a | 2012-06-01 08:38:36 | [diff] [blame] | 67 | struct WebIntentServiceData; |
[email protected] | daf82f8 | 2011-10-31 22:35:31 | [diff] [blame] | 68 | } |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 69 | |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 70 | class CONTENT_EXPORT WebContentsImpl |
[email protected] | 01d6517 | 2011-12-25 04:39:30 | [diff] [blame] | 71 | : public NON_EXPORTED_BASE(content::WebContents), |
[email protected] | b0b67cf | 2012-01-18 21:59:57 | [diff] [blame] | 72 | public content::RenderViewHostDelegate, |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 73 | public content::RenderWidgetHostDelegate, |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 74 | public RenderViewHostManager::Delegate, |
| 75 | public content::NotificationObserver { |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 76 | public: |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 77 | virtual ~WebContentsImpl(); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 78 | |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 79 | static WebContentsImpl* Create( |
| 80 | content::BrowserContext* browser_context, |
| 81 | content::SiteInstance* site_instance, |
| 82 | int routing_id, |
| 83 | const WebContentsImpl* base_web_contents); |
| 84 | |
| 85 | static WebContentsImpl* CreateWithOpener( |
| 86 | content::BrowserContext* browser_context, |
| 87 | content::SiteInstance* site_instance, |
| 88 | int routing_id, |
| 89 | const WebContentsImpl* base_web_contents, |
| 90 | WebContentsImpl* opener); |
| 91 | |
[email protected] | 64d69de4 | 2012-02-06 00:19:54 | [diff] [blame] | 92 | // Returns the content specific prefs for the given RVH. |
[email protected] | 6717bf27 | 2012-05-11 23:31:25 | [diff] [blame] | 93 | static webkit_glue::WebPreferences GetWebkitPrefs( |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 94 | content::RenderViewHost* rvh, const GURL& url); |
[email protected] | 64d69de4 | 2012-02-06 00:19:54 | [diff] [blame] | 95 | |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 96 | // Complex initialization here. Specifically needed to avoid having |
| 97 | // members call back into our virtual functions in the constructor. |
| 98 | virtual void Init(content::BrowserContext* browser_context, |
| 99 | content::SiteInstance* site_instance, |
| 100 | int routing_id, |
| 101 | const content::WebContents* base_web_contents); |
| 102 | |
[email protected] | c7dd2f6 | 2011-07-18 15:57:59 | [diff] [blame] | 103 | // Returns the SavePackage which manages the page saving job. May be NULL. |
| 104 | SavePackage* save_package() const { return save_package_.get(); } |
| 105 | |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 106 | // Updates the max page ID for the current SiteInstance in this |
| 107 | // WebContentsImpl to be at least |page_id|. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 108 | void UpdateMaxPageID(int32 page_id); |
| 109 | |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 110 | // Updates the max page ID for the given SiteInstance in this WebContentsImpl |
[email protected] | 74ce1ad | 2011-12-16 21:51:46 | [diff] [blame] | 111 | // to be at least |page_id|. |
[email protected] | b658359 | 2012-01-25 19:52:33 | [diff] [blame] | 112 | void UpdateMaxPageIDForSiteInstance(content::SiteInstance* site_instance, |
[email protected] | 74ce1ad | 2011-12-16 21:51:46 | [diff] [blame] | 113 | int32 page_id); |
| 114 | |
[email protected] | 91854cd | 2012-01-10 19:43:57 | [diff] [blame] | 115 | // Copy the current map of SiteInstance ID to max page ID from another tab. |
| 116 | // This is necessary when this tab adopts the NavigationEntries from |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 117 | // |web_contents|. |
| 118 | void CopyMaxPageIDsFrom(WebContentsImpl* web_contents); |
[email protected] | 91854cd | 2012-01-10 19:43:57 | [diff] [blame] | 119 | |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 120 | // Called by the NavigationController to cause the WebContentsImpl to navigate |
| 121 | // to the current pending entry. The NavigationController should be called |
| 122 | // back with RendererDidNavigate on success or DiscardPendingEntry on failure. |
[email protected] | 9a7e68c | 2011-05-26 17:35:50 | [diff] [blame] | 123 | // The callbacks can be inside of this function, or at some future time. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 124 | // |
| 125 | // The entry has a PageID of -1 if newly created (corresponding to navigation |
| 126 | // to a new URL). |
| 127 | // |
| 128 | // If this method returns false, then the navigation is discarded (equivalent |
| 129 | // to calling DiscardPendingEntry on the NavigationController). |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 130 | bool NavigateToPendingEntry( |
[email protected] | 71fde35 | 2011-12-29 03:29:56 | [diff] [blame] | 131 | content::NavigationController::ReloadType reload_type); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 132 | |
[email protected] | ba45bfd | 2012-05-22 21:51:44 | [diff] [blame] | 133 | // Called by InterstitialPageImpl when it creates a RenderViewHost. |
| 134 | void RenderViewForInterstitialPageCreated( |
| 135 | content::RenderViewHost* render_view_host); |
| 136 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 137 | // Sets the passed passed interstitial as the currently showing interstitial. |
| 138 | // |interstitial_page| should be non NULL (use the remove_interstitial_page |
| 139 | // method to unset the interstitial) and no interstitial page should be set |
| 140 | // when there is already a non NULL interstitial page set. |
[email protected] | cadaec5 | 2012-02-08 21:53:13 | [diff] [blame] | 141 | void set_interstitial_page(InterstitialPageImpl* interstitial_page) { |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 142 | render_manager_.set_interstitial_page(interstitial_page); |
| 143 | } |
| 144 | |
| 145 | // Unsets the currently showing interstitial. |
| 146 | void remove_interstitial_page() { |
| 147 | render_manager_.remove_interstitial_page(); |
| 148 | } |
| 149 | |
[email protected] | 01ec4ec | 2012-01-18 04:13:47 | [diff] [blame] | 150 | void set_opener_web_ui_type(content::WebUI::TypeID opener_web_ui_type) { |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 151 | opener_web_ui_type_ = opener_web_ui_type; |
| 152 | } |
| 153 | |
[email protected] | 276b37a2 | 2011-11-08 20:45:46 | [diff] [blame] | 154 | JavaBridgeDispatcherHostManager* java_bridge_dispatcher_host_manager() const { |
| 155 | return java_bridge_dispatcher_host_manager_.get(); |
| 156 | } |
| 157 | |
[email protected] | dd26779c | 2012-08-08 01:50:28 | [diff] [blame] | 158 | content::old::BrowserPluginHost* old_browser_plugin_host() const { |
| 159 | return old_browser_plugin_host_.get(); |
[email protected] | 172cf71 | 2012-05-23 15:07:39 | [diff] [blame] | 160 | } |
| 161 | |
[email protected] | 76518718 | 2012-01-11 23:59:28 | [diff] [blame] | 162 | // Expose the render manager for testing. |
| 163 | RenderViewHostManager* GetRenderManagerForTesting(); |
| 164 | |
[email protected] | 58f5d56 | 2011-12-20 17:13:03 | [diff] [blame] | 165 | // content::WebContents ------------------------------------------------------ |
[email protected] | 6934a70 | 2011-12-20 00:04:51 | [diff] [blame] | 166 | virtual const base::PropertyBag* GetPropertyBag() const OVERRIDE; |
| 167 | virtual base::PropertyBag* GetPropertyBag() OVERRIDE; |
[email protected] | 674bc59 | 2011-12-20 23:00:42 | [diff] [blame] | 168 | virtual content::WebContentsDelegate* GetDelegate() OVERRIDE; |
| 169 | virtual void SetDelegate(content::WebContentsDelegate* delegate) OVERRIDE; |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 170 | virtual NavigationControllerImpl& GetController() OVERRIDE; |
| 171 | virtual const NavigationControllerImpl& GetController() const OVERRIDE; |
[email protected] | 627e051 | 2011-12-21 22:55:30 | [diff] [blame] | 172 | virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; |
[email protected] | f5fa20e | 2011-12-21 22:35:56 | [diff] [blame] | 173 | virtual content::RenderProcessHost* GetRenderProcessHost() const OVERRIDE; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 174 | virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE; |
[email protected] | 6b618e6 | 2012-08-16 12:59:18 | [diff] [blame^] | 175 | virtual int GetRoutingID() const OVERRIDE; |
[email protected] | 5626b089 | 2012-02-20 14:46:58 | [diff] [blame] | 176 | virtual content::RenderWidgetHostView* |
| 177 | GetRenderWidgetHostView() const OVERRIDE; |
[email protected] | 8643e6d | 2012-01-18 20:26:10 | [diff] [blame] | 178 | virtual content::WebContentsView* GetView() const OVERRIDE; |
[email protected] | 01ec4ec | 2012-01-18 04:13:47 | [diff] [blame] | 179 | virtual content::WebUI* CreateWebUI(const GURL& url) OVERRIDE; |
| 180 | virtual content::WebUI* GetWebUI() const OVERRIDE; |
| 181 | virtual content::WebUI* GetCommittedWebUI() const OVERRIDE; |
[email protected] | 86ef6a39 | 2012-05-11 22:03:11 | [diff] [blame] | 182 | virtual void SetUserAgentOverride(const std::string& override) OVERRIDE; |
| 183 | virtual const std::string& GetUserAgentOverride() const OVERRIDE; |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 184 | virtual const string16& GetTitle() const OVERRIDE; |
| 185 | virtual int32 GetMaxPageID() OVERRIDE; |
| 186 | virtual int32 GetMaxPageIDForSiteInstance( |
[email protected] | b658359 | 2012-01-25 19:52:33 | [diff] [blame] | 187 | content::SiteInstance* site_instance) OVERRIDE; |
| 188 | virtual content::SiteInstance* GetSiteInstance() const OVERRIDE; |
| 189 | virtual content::SiteInstance* GetPendingSiteInstance() const OVERRIDE; |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 190 | virtual bool IsLoading() const OVERRIDE; |
| 191 | virtual bool IsWaitingForResponse() const OVERRIDE; |
| 192 | virtual const net::LoadStateWithParam& GetLoadState() const OVERRIDE; |
| 193 | virtual const string16& GetLoadStateHost() const OVERRIDE; |
| 194 | virtual uint64 GetUploadSize() const OVERRIDE; |
| 195 | virtual uint64 GetUploadPosition() const OVERRIDE; |
| 196 | virtual const std::string& GetEncoding() const OVERRIDE; |
| 197 | virtual bool DisplayedInsecureContent() const OVERRIDE; |
| 198 | virtual void SetCapturingContents(bool cap) OVERRIDE; |
| 199 | virtual bool IsCrashed() const OVERRIDE; |
| 200 | virtual void SetIsCrashed(base::TerminationStatus status, |
| 201 | int error_code) OVERRIDE; |
| 202 | virtual base::TerminationStatus GetCrashedStatus() const OVERRIDE; |
| 203 | virtual bool IsBeingDestroyed() const OVERRIDE; |
| 204 | virtual void NotifyNavigationStateChanged(unsigned changed_flags) OVERRIDE; |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 205 | virtual base::TimeTicks GetLastSelectedTime() const OVERRIDE; |
[email protected] | 9e2e463 | 2012-07-27 16:38:41 | [diff] [blame] | 206 | virtual void WasShown() OVERRIDE; |
[email protected] | 3e32414 | 2012-06-25 18:26:33 | [diff] [blame] | 207 | virtual void WasHidden() OVERRIDE; |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 208 | virtual bool NeedToFireBeforeUnload() OVERRIDE; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 209 | virtual void Stop() OVERRIDE; |
[email protected] | d908348 | 2012-01-06 00:38:46 | [diff] [blame] | 210 | virtual content::WebContents* Clone() OVERRIDE; |
[email protected] | 2a6bc3e | 2011-12-28 23:51:33 | [diff] [blame] | 211 | virtual void AddNewContents(content::WebContents* new_contents, |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 212 | WindowOpenDisposition disposition, |
| 213 | const gfx::Rect& initial_pos, |
| 214 | bool user_gesture) OVERRIDE; |
| 215 | virtual gfx::NativeView GetContentNativeView() const OVERRIDE; |
| 216 | virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 217 | virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE; |
| 218 | virtual void Focus() OVERRIDE; |
| 219 | virtual void FocusThroughTabTraversal(bool reverse) OVERRIDE; |
| 220 | virtual bool ShowingInterstitialPage() const OVERRIDE; |
[email protected] | cadaec5 | 2012-02-08 21:53:13 | [diff] [blame] | 221 | virtual content::InterstitialPage* GetInterstitialPage() const OVERRIDE; |
[email protected] | a53209b | 2012-01-20 16:48:16 | [diff] [blame] | 222 | virtual bool IsSavable() OVERRIDE; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 223 | virtual void OnSavePage() OVERRIDE; |
| 224 | virtual bool SavePage(const FilePath& main_file, |
| 225 | const FilePath& dir_path, |
[email protected] | a53209b | 2012-01-20 16:48:16 | [diff] [blame] | 226 | content::SavePageType save_type) OVERRIDE; |
[email protected] | aa4f397 | 2012-03-01 18:12:12 | [diff] [blame] | 227 | virtual void GenerateMHTML( |
| 228 | const FilePath& file, |
| 229 | const base::Callback<void(const FilePath&, int64)>& callback) OVERRIDE; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 230 | virtual bool IsActiveEntry(int32 page_id) OVERRIDE; |
| 231 | |
| 232 | virtual const std::string& GetContentsMimeType() const OVERRIDE; |
| 233 | virtual bool WillNotifyDisconnection() const OVERRIDE; |
| 234 | virtual void SetOverrideEncoding(const std::string& encoding) OVERRIDE; |
| 235 | virtual void ResetOverrideEncoding() OVERRIDE; |
| 236 | virtual content::RendererPreferences* GetMutableRendererPrefs() OVERRIDE; |
| 237 | virtual void SetNewTabStartTime(const base::TimeTicks& time) OVERRIDE; |
| 238 | virtual base::TimeTicks GetNewTabStartTime() const OVERRIDE; |
[email protected] | e35ccd5 | 2012-05-23 16:22:47 | [diff] [blame] | 239 | virtual void Close() OVERRIDE; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 240 | virtual void OnCloseStarted() OVERRIDE; |
| 241 | virtual bool ShouldAcceptDragAndDrop() const OVERRIDE; |
| 242 | virtual void SystemDragEnded() OVERRIDE; |
[email protected] | e35ccd5 | 2012-05-23 16:22:47 | [diff] [blame] | 243 | virtual void UserGestureDone() OVERRIDE; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 244 | virtual void SetClosedByUserGesture(bool value) OVERRIDE; |
| 245 | virtual bool GetClosedByUserGesture() const OVERRIDE; |
| 246 | virtual double GetZoomLevel() const OVERRIDE; |
| 247 | virtual int GetZoomPercent(bool* enable_increment, |
| 248 | bool* enable_decrement) OVERRIDE; |
| 249 | virtual void ViewSource() OVERRIDE; |
| 250 | virtual void ViewFrameSource(const GURL& url, |
| 251 | const std::string& content_state) OVERRIDE; |
| 252 | virtual int GetMinimumZoomPercent() const OVERRIDE; |
| 253 | virtual int GetMaximumZoomPercent() const OVERRIDE; |
[email protected] | bcd281560 | 2012-01-14 18:17:23 | [diff] [blame] | 254 | virtual gfx::Size GetPreferredSize() const OVERRIDE; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 255 | virtual int GetContentRestrictions() const OVERRIDE; |
[email protected] | 01ec4ec | 2012-01-18 04:13:47 | [diff] [blame] | 256 | virtual content::WebUI::TypeID GetWebUITypeForCurrentState() OVERRIDE; |
| 257 | virtual content::WebUI* GetWebUIForCurrentState() OVERRIDE; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 258 | virtual bool GotResponseToLockMouseRequest(bool allowed) OVERRIDE; |
[email protected] | a0358d7 | 2012-03-09 14:06:50 | [diff] [blame] | 259 | virtual bool HasOpener() const OVERRIDE; |
[email protected] | da854376 | 2012-03-20 08:52:20 | [diff] [blame] | 260 | virtual void DidChooseColorInColorChooser(int color_chooser_id, |
[email protected] | 55578b0a | 2012-04-18 14:31:32 | [diff] [blame] | 261 | SkColor color) OVERRIDE; |
[email protected] | da854376 | 2012-03-20 08:52:20 | [diff] [blame] | 262 | virtual void DidEndColorChooser(int color_chooser_id) OVERRIDE; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 263 | |
| 264 | // Implementation of PageNavigator. |
[email protected] | e5d549d | 2011-12-28 01:29:20 | [diff] [blame] | 265 | virtual content::WebContents* OpenURL( |
| 266 | const content::OpenURLParams& params) OVERRIDE; |
[email protected] | 151a63d | 2011-12-20 22:32:52 | [diff] [blame] | 267 | |
[email protected] | 6b618e6 | 2012-08-16 12:59:18 | [diff] [blame^] | 268 | // Implementation of IPC::Sender. |
| 269 | virtual bool Send(IPC::Message* message) OVERRIDE; |
| 270 | |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 271 | // RenderViewHostDelegate ---------------------------------------------------- |
| 272 | |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 273 | virtual content::RenderViewHostDelegateView* GetDelegateView() OVERRIDE; |
[email protected] | b0b67cf | 2012-01-18 21:59:57 | [diff] [blame] | 274 | virtual content::RenderViewHostDelegate::RendererManagement* |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 275 | GetRendererManagementDelegate() OVERRIDE; |
[email protected] | 7bb76189 | 2012-07-20 09:32:47 | [diff] [blame] | 276 | virtual bool OnMessageReceived(content::RenderViewHost* render_view_host, |
| 277 | const IPC::Message& message) OVERRIDE; |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 278 | virtual const GURL& GetURL() const OVERRIDE; |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 279 | virtual content::WebContents* GetAsWebContents() OVERRIDE; |
[email protected] | b7a756d4 | 2012-01-23 18:08:17 | [diff] [blame] | 280 | virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 281 | virtual void RenderViewCreated( |
| 282 | content::RenderViewHost* render_view_host) OVERRIDE; |
| 283 | virtual void RenderViewReady( |
| 284 | content::RenderViewHost* render_view_host) OVERRIDE; |
| 285 | virtual void RenderViewGone(content::RenderViewHost* render_view_host, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 286 | base::TerminationStatus status, |
| 287 | int error_code) OVERRIDE; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 288 | virtual void RenderViewDeleted( |
| 289 | content::RenderViewHost* render_view_host) OVERRIDE; |
[email protected] | 54047eb5 | 2012-05-08 21:45:57 | [diff] [blame] | 290 | virtual void DidStartProvisionalLoadForFrame( |
| 291 | content::RenderViewHost* render_view_host, |
| 292 | int64 frame_id, |
| 293 | bool main_frame, |
| 294 | const GURL& opener_url, |
| 295 | const GURL& url) OVERRIDE; |
[email protected] | 400992b | 2012-06-14 00:03:54 | [diff] [blame] | 296 | virtual void DidRedirectProvisionalLoad( |
| 297 | content::RenderViewHost* render_view_host, |
| 298 | int32 page_id, |
| 299 | const GURL& opener_url, |
| 300 | const GURL& source_url, |
| 301 | const GURL& target_url) OVERRIDE; |
[email protected] | 54047eb5 | 2012-05-08 21:45:57 | [diff] [blame] | 302 | virtual void DidFailProvisionalLoadWithError( |
| 303 | content::RenderViewHost* render_view_host, |
| 304 | const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) |
| 305 | OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 306 | virtual void DidNavigate( |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 307 | content::RenderViewHost* render_view_host, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 308 | const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 309 | virtual void UpdateState(content::RenderViewHost* render_view_host, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 310 | int32 page_id, |
| 311 | const std::string& state) OVERRIDE; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 312 | virtual void UpdateTitle(content::RenderViewHost* render_view_host, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 313 | int32 page_id, |
| 314 | const string16& title, |
| 315 | base::i18n::TextDirection title_direction) OVERRIDE; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 316 | virtual void UpdateEncoding(content::RenderViewHost* render_view_host, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 317 | const std::string& encoding) OVERRIDE; |
| 318 | virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 319 | virtual void Close(content::RenderViewHost* render_view_host) OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 320 | virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 321 | virtual void SwappedOut(content::RenderViewHost* render_view_host) OVERRIDE; |
[email protected] | 8979307 | 2012-07-23 22:25:29 | [diff] [blame] | 322 | virtual void DidStartLoading( |
| 323 | content::RenderViewHost* render_view_host) OVERRIDE; |
| 324 | virtual void DidStopLoading( |
| 325 | content::RenderViewHost* render_view_host) OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 326 | virtual void DidCancelLoading() OVERRIDE; |
| 327 | virtual void DidChangeLoadProgress(double progress) OVERRIDE; |
[email protected] | 87717d0e | 2012-04-26 02:58:43 | [diff] [blame] | 328 | virtual void DocumentAvailableInMainFrame( |
| 329 | content::RenderViewHost* render_view_host) OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 330 | virtual void DocumentOnLoadCompletedInMainFrame( |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 331 | content::RenderViewHost* render_view_host, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 332 | int32 page_id) OVERRIDE; |
[email protected] | 196159d | 2012-05-04 17:26:54 | [diff] [blame] | 333 | virtual void RequestOpenURL(content::RenderViewHost* rvh, |
| 334 | const GURL& url, |
[email protected] | 445e104 | 2011-12-03 21:03:15 | [diff] [blame] | 335 | const content::Referrer& referrer, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 336 | WindowOpenDisposition disposition, |
| 337 | int64 source_frame_id) OVERRIDE; |
[email protected] | 4ad5d77d | 2011-12-03 02:00:48 | [diff] [blame] | 338 | virtual void RequestTransferURL( |
| 339 | const GURL& url, |
[email protected] | bce1f1c | 2011-12-05 15:11:58 | [diff] [blame] | 340 | const content::Referrer& referrer, |
[email protected] | 4ad5d77d | 2011-12-03 02:00:48 | [diff] [blame] | 341 | WindowOpenDisposition disposition, |
| 342 | int64 source_frame_id, |
[email protected] | e5d549d | 2011-12-28 01:29:20 | [diff] [blame] | 343 | const content::GlobalRequestID& transferred_global_request_id) OVERRIDE; |
[email protected] | e1c3a55 | 2012-05-04 20:51:32 | [diff] [blame] | 344 | virtual void RouteCloseEvent(content::RenderViewHost* rvh) OVERRIDE; |
[email protected] | f546640b | 2012-05-15 00:03:49 | [diff] [blame] | 345 | virtual void RouteMessageEvent( |
| 346 | content::RenderViewHost* rvh, |
| 347 | const ViewMsg_PostMessage_Params& params) OVERRIDE; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 348 | virtual void RunJavaScriptMessage(content::RenderViewHost* rvh, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 349 | const string16& message, |
| 350 | const string16& default_prompt, |
| 351 | const GURL& frame_url, |
[email protected] | be2510c0 | 2012-05-28 14:52:14 | [diff] [blame] | 352 | content::JavaScriptMessageType type, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 353 | IPC::Message* reply_msg, |
| 354 | bool* did_suppress_message) OVERRIDE; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 355 | virtual void RunBeforeUnloadConfirm(content::RenderViewHost* rvh, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 356 | const string16& message, |
[email protected] | 3b3301f6 | 2012-02-29 04:32:32 | [diff] [blame] | 357 | bool is_reload, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 358 | IPC::Message* reply_msg) OVERRIDE; |
[email protected] | a796f20 | 2012-05-30 14:14:25 | [diff] [blame] | 359 | virtual bool AddMessageToConsole(int32 level, |
| 360 | const string16& message, |
| 361 | int32 line_no, |
| 362 | const string16& source_id) OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 363 | virtual content::RendererPreferences GetRendererPrefs( |
| 364 | content::BrowserContext* browser_context) const OVERRIDE; |
[email protected] | 6717bf27 | 2012-05-11 23:31:25 | [diff] [blame] | 365 | virtual webkit_glue::WebPreferences GetWebkitPrefs() OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 366 | virtual void OnUserGesture() OVERRIDE; |
| 367 | virtual void OnIgnoredUIEvent() OVERRIDE; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 368 | virtual void RendererUnresponsive(content::RenderViewHost* render_view_host, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 369 | bool is_during_unload) OVERRIDE; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 370 | virtual void RendererResponsive( |
| 371 | content::RenderViewHost* render_view_host) OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 372 | virtual void LoadStateChanged(const GURL& url, |
| 373 | const net::LoadStateWithParam& load_state, |
| 374 | uint64 upload_position, |
| 375 | uint64 upload_size) OVERRIDE; |
| 376 | virtual void WorkerCrashed() OVERRIDE; |
| 377 | virtual void Activate() OVERRIDE; |
| 378 | virtual void Deactivate() OVERRIDE; |
| 379 | virtual void LostCapture() OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 380 | virtual void HandleMouseDown() OVERRIDE; |
| 381 | virtual void HandleMouseUp() OVERRIDE; |
[email protected] | 590a634e | 2012-07-19 16:38:23 | [diff] [blame] | 382 | virtual void HandlePointerActivate() OVERRIDE; |
| 383 | virtual void HandleGestureBegin() OVERRIDE; |
| 384 | virtual void HandleGestureEnd() OVERRIDE; |
[email protected] | edc64de | 2011-11-17 20:07:38 | [diff] [blame] | 385 | virtual void RunFileChooser( |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 386 | content::RenderViewHost* render_view_host, |
[email protected] | 8caadeb | 2011-11-22 02:45:23 | [diff] [blame] | 387 | const content::FileChooserParams& params) OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 388 | virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE; |
| 389 | virtual bool IsFullscreenForCurrentTab() const OVERRIDE; |
| 390 | virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE; |
[email protected] | 61e2b3cc | 2012-03-02 16:13:34 | [diff] [blame] | 391 | virtual void ResizeDueToAutoResize(const gfx::Size& new_size) OVERRIDE; |
[email protected] | a9c81f0 | 2012-06-01 00:15:44 | [diff] [blame] | 392 | virtual void RequestToLockMouse(bool user_gesture, |
| 393 | bool last_unlocked_by_target) OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 394 | virtual void LostMouseLock() OVERRIDE; |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 395 | virtual void CreateNewWindow( |
| 396 | int route_id, |
[email protected] | 97714c8 | 2012-06-06 10:15:13 | [diff] [blame] | 397 | const ViewHostMsg_CreateWindow_Params& params, |
| 398 | content::SessionStorageNamespace* session_storage_namespace) OVERRIDE; |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 399 | virtual void CreateNewWidget(int route_id, |
| 400 | WebKit::WebPopupType popup_type) OVERRIDE; |
| 401 | virtual void CreateNewFullscreenWidget(int route_id) OVERRIDE; |
| 402 | virtual void ShowCreatedWindow(int route_id, |
| 403 | WindowOpenDisposition disposition, |
| 404 | const gfx::Rect& initial_pos, |
| 405 | bool user_gesture) OVERRIDE; |
| 406 | virtual void ShowCreatedWidget(int route_id, |
| 407 | const gfx::Rect& initial_pos) OVERRIDE; |
| 408 | virtual void ShowCreatedFullscreenWidget(int route_id) OVERRIDE; |
| 409 | virtual void ShowContextMenu( |
| 410 | const content::ContextMenuParams& params) OVERRIDE; |
[email protected] | f13b420 | 2012-06-12 23:53:23 | [diff] [blame] | 411 | virtual void RequestMediaAccessPermission( |
| 412 | const content::MediaStreamRequest* request, |
| 413 | const content::MediaResponseCallback& callback) OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 414 | |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 415 | // RenderWidgetHostDelegate -------------------------------------------------- |
| 416 | |
[email protected] | b87ee52 | 2012-05-18 15:16:54 | [diff] [blame] | 417 | virtual bool PreHandleKeyboardEvent( |
| 418 | const content::NativeWebKeyboardEvent& event, |
| 419 | bool* is_keyboard_shortcut) OVERRIDE; |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 420 | virtual void HandleKeyboardEvent( |
[email protected] | b87ee52 | 2012-05-18 15:16:54 | [diff] [blame] | 421 | const content::NativeWebKeyboardEvent& event) OVERRIDE; |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 422 | |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 423 | // RenderViewHostManager::Delegate ------------------------------------------- |
| 424 | |
| 425 | virtual bool CreateRenderViewForRenderManager( |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 426 | content::RenderViewHost* render_view_host, int opener_route_id) OVERRIDE; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 427 | virtual void BeforeUnloadFiredFromRenderManager( |
| 428 | bool proceed, |
| 429 | bool* proceed_to_fire_unload) OVERRIDE; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 430 | virtual void RenderViewGoneFromRenderManager( |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 431 | content::RenderViewHost* render_view_host) OVERRIDE; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 432 | virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE; |
| 433 | virtual void NotifySwappedFromRenderManager() OVERRIDE; |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 434 | virtual int CreateOpenerRenderViewsForRenderManager( |
| 435 | content::SiteInstance* instance) OVERRIDE; |
[email protected] | d202a7c | 2012-01-04 07:53:47 | [diff] [blame] | 436 | virtual NavigationControllerImpl& GetControllerForRenderManager() OVERRIDE; |
[email protected] | d235345 | 2012-01-19 19:53:56 | [diff] [blame] | 437 | virtual WebUIImpl* CreateWebUIForRenderManager(const GURL& url) OVERRIDE; |
[email protected] | ad23a09 | 2011-12-28 07:02:04 | [diff] [blame] | 438 | virtual content::NavigationEntry* |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 439 | GetLastCommittedNavigationEntryForRenderManager() OVERRIDE; |
| 440 | virtual bool FocusLocationBarByDefault() OVERRIDE; |
| 441 | virtual void SetFocusToLocationBar(bool select_all) OVERRIDE; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 442 | virtual void CreateViewAndSetSizeForRVH( |
| 443 | content::RenderViewHost* rvh) OVERRIDE; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 444 | |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 445 | // content::NotificationObserver --------------------------------------------- |
| 446 | |
| 447 | virtual void Observe(int type, |
| 448 | const content::NotificationSource& source, |
| 449 | const content::NotificationDetails& details) OVERRIDE; |
| 450 | |
[email protected] | 553602e1 | 2011-04-05 17:01:18 | [diff] [blame] | 451 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 452 | private: |
[email protected] | d202a7c | 2012-01-04 07:53:47 | [diff] [blame] | 453 | friend class NavigationControllerImpl; |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 454 | friend class content::WebContentsObserver; |
| 455 | friend class content::WebContents; // To implement factory methods. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 456 | |
[email protected] | 2db9bd7 | 2012-04-13 20:20:56 | [diff] [blame] | 457 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); |
| 458 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); |
| 459 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
| 460 | CrossSiteCantPreemptAfterUnload); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 461 | FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); |
| 462 | FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); |
| 463 | FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload); |
| 464 | |
[email protected] | cadaec5 | 2012-02-08 21:53:13 | [diff] [blame] | 465 | // So InterstitialPageImpl can access SetIsLoading. |
| 466 | friend class InterstitialPageImpl; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 467 | |
[email protected] | 80e776ae | 2012-03-23 16:17:20 | [diff] [blame] | 468 | // TODO(brettw) TestWebContents shouldn't exist! |
| 469 | friend class content::TestWebContents; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 470 | |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 471 | // See WebContents::Create for a description of these parameters. |
| 472 | WebContentsImpl(content::BrowserContext* browser_context, |
| 473 | WebContentsImpl* opener); |
| 474 | |
| 475 | // Add and remove observers for page navigation notifications. Adding or |
| 476 | // removing multiple times has no effect. The order in which notifications |
| 477 | // are sent to observers is undefined. Clients must be sure to remove the |
| 478 | // observer before they go away. |
| 479 | void AddObserver(content::WebContentsObserver* observer); |
| 480 | void RemoveObserver(content::WebContentsObserver* observer); |
| 481 | |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 482 | // Clears this tab's opener if it has been closed. |
| 483 | void OnWebContentsDestroyed(content::WebContents* web_contents); |
| 484 | |
[email protected] | 51da7e3 | 2012-01-30 19:24:52 | [diff] [blame] | 485 | // Callback function when showing JS dialogs. |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 486 | void OnDialogClosed(content::RenderViewHost* rvh, |
[email protected] | 51da7e3 | 2012-01-30 19:24:52 | [diff] [blame] | 487 | IPC::Message* reply_msg, |
| 488 | bool success, |
| 489 | const string16& user_input); |
| 490 | |
[email protected] | d0759f49 | 2012-04-19 22:50:50 | [diff] [blame] | 491 | // IPC message handlers. |
[email protected] | 3a3b75a | 2012-06-01 08:38:36 | [diff] [blame] | 492 | void OnRegisterIntentService(const webkit_glue::WebIntentServiceData& data, |
| 493 | bool user_gesture); |
[email protected] | 67810501 | 2011-12-09 04:01:21 | [diff] [blame] | 494 | void OnWebIntentDispatch(const webkit_glue::WebIntentData& intent, |
[email protected] | 63c23932 | 2011-10-31 23:56:30 | [diff] [blame] | 495 | int intent_id); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 496 | void OnDidLoadResourceFromMemoryCache(const GURL& url, |
[email protected] | 7043596 | 2011-08-02 20:13:28 | [diff] [blame] | 497 | const std::string& security_info, |
| 498 | const std::string& http_request, |
[email protected] | 6d6cfb3a | 2012-05-23 22:53:18 | [diff] [blame] | 499 | const std::string& mime_type, |
[email protected] | 7043596 | 2011-08-02 20:13:28 | [diff] [blame] | 500 | ResourceType::Type resource_type); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 501 | void OnDidDisplayInsecureContent(); |
| 502 | void OnDidRunInsecureContent(const std::string& security_origin, |
| 503 | const GURL& target_url); |
| 504 | void OnDocumentLoadedInFrame(int64 frame_id); |
[email protected] | 1a55c5be | 2011-11-29 11:36:31 | [diff] [blame] | 505 | void OnDidFinishLoad(int64 frame_id, |
| 506 | const GURL& validated_url, |
| 507 | bool is_main_frame); |
| 508 | void OnDidFailLoadWithError(int64 frame_id, |
| 509 | const GURL& validated_url, |
| 510 | bool is_main_frame, |
| 511 | int error_code, |
| 512 | const string16& error_description); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 513 | void OnUpdateContentRestrictions(int restrictions); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 514 | void OnGoToEntryAtOffset(int offset); |
[email protected] | 21681395 | 2011-05-19 22:21:26 | [diff] [blame] | 515 | void OnUpdateZoomLimits(int minimum_percent, |
| 516 | int maximum_percent, |
| 517 | bool remember); |
[email protected] | 20b433a | 2012-05-15 21:23:46 | [diff] [blame] | 518 | void OnSaveURL(const GURL& url, const content::Referrer& referrer); |
[email protected] | 3a29a6e | 2011-08-24 18:26:21 | [diff] [blame] | 519 | void OnEnumerateDirectory(int request_id, const FilePath& path); |
[email protected] | 7d18902 | 2011-08-25 22:54:20 | [diff] [blame] | 520 | void OnJSOutOfMemory(); |
[email protected] | b7a756d4 | 2012-01-23 18:08:17 | [diff] [blame] | 521 | |
[email protected] | 7d18902 | 2011-08-25 22:54:20 | [diff] [blame] | 522 | void OnRegisterProtocolHandler(const std::string& protocol, |
| 523 | const GURL& url, |
[email protected] | 3a3b75a | 2012-06-01 08:38:36 | [diff] [blame] | 524 | const string16& title, |
| 525 | bool user_gesture); |
[email protected] | b888919c | 2011-09-02 00:32:16 | [diff] [blame] | 526 | void OnFindReply(int request_id, int number_of_matches, |
| 527 | const gfx::Rect& selection_rect, int active_match_ordinal, |
| 528 | bool final_update); |
[email protected] | d952a05 | 2011-09-06 18:42:45 | [diff] [blame] | 529 | void OnCrashedPlugin(const FilePath& plugin_path); |
[email protected] | 7fc4bbb | 2011-09-08 21:23:10 | [diff] [blame] | 530 | void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); |
[email protected] | 55578b0a | 2012-04-18 14:31:32 | [diff] [blame] | 531 | void OnOpenColorChooser(int color_chooser_id, SkColor color); |
[email protected] | da854376 | 2012-03-20 08:52:20 | [diff] [blame] | 532 | void OnEndColorChooser(int color_chooser_id); |
[email protected] | 55578b0a | 2012-04-18 14:31:32 | [diff] [blame] | 533 | void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color); |
[email protected] | 8be4584 | 2012-04-13 19:49:29 | [diff] [blame] | 534 | void OnPepperPluginHung(int plugin_child_id, |
| 535 | const FilePath& path, |
| 536 | bool is_hung); |
[email protected] | d0759f49 | 2012-04-19 22:50:50 | [diff] [blame] | 537 | void OnWebUISend(const GURL& source_url, |
| 538 | const std::string& name, |
| 539 | const base::ListValue& args); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 540 | |
| 541 | // Changes the IsLoading state and notifies delegate as needed |
| 542 | // |details| is used to provide details on the load that just finished |
| 543 | // (but can be null if not applicable). Can be overridden. |
| 544 | void SetIsLoading(bool is_loading, |
[email protected] | 09d31d5 | 2012-03-11 22:30:27 | [diff] [blame] | 545 | content::LoadNotificationDetails* details); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 546 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 547 | // Called by derived classes to indicate that we're no longer waiting for a |
| 548 | // response. This won't actually update the throbber, but it will get picked |
| 549 | // up at the next animation step if the throbber is going. |
| 550 | void SetNotWaitingForResponse() { waiting_for_response_ = false; } |
| 551 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 552 | // Navigation helpers -------------------------------------------------------- |
| 553 | // |
| 554 | // These functions are helpers for Navigate() and DidNavigate(). |
| 555 | |
| 556 | // Handles post-navigation tasks in DidNavigate AFTER the entry has been |
| 557 | // committed to the navigation controller. Note that the navigation entry is |
| 558 | // not provided since it may be invalid/changed after being committed. The |
| 559 | // current navigation entry is in the NavigationController at this point. |
| 560 | void DidNavigateMainFramePostCommit( |
[email protected] | 8286f51a | 2011-05-31 17:39:13 | [diff] [blame] | 561 | const content::LoadCommittedDetails& details, |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 562 | const ViewHostMsg_FrameNavigate_Params& params); |
| 563 | void DidNavigateAnyFramePostCommit( |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 564 | content::RenderViewHost* render_view_host, |
[email protected] | 8286f51a | 2011-05-31 17:39:13 | [diff] [blame] | 565 | const content::LoadCommittedDetails& details, |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 566 | const ViewHostMsg_FrameNavigate_Params& params); |
| 567 | |
[email protected] | 74ce1ad | 2011-12-16 21:51:46 | [diff] [blame] | 568 | // If our controller was restored, update the max page ID associated with the |
| 569 | // given RenderViewHost to be larger than the number of restored entries. |
| 570 | // This is called in CreateRenderView before any navigations in the RenderView |
| 571 | // have begun, to prevent any races in updating RenderView::next_page_id. |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 572 | void UpdateMaxPageIDIfNecessary(content::RenderViewHost* rvh); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 573 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 574 | // Saves the given title to the navigation entry and does associated work. It |
| 575 | // will update history and the view for the new title, and also synthesize |
| 576 | // titles for file URLs that have none (so we require that the URL of the |
| 577 | // entry already be set). |
| 578 | // |
| 579 | // This is used as the backend for state updates, which include a new title, |
| 580 | // or the dedicated set title message. It returns true if the new title is |
| 581 | // different and was therefore updated. |
[email protected] | 10f417c5 | 2011-12-28 21:04:23 | [diff] [blame] | 582 | bool UpdateTitleForEntry(content::NavigationEntryImpl* entry, |
| 583 | const string16& title); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 584 | |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 585 | // Causes the WebContentsImpl to navigate in the right renderer to |entry|, |
| 586 | // which must be already part of the entries in the navigation controller. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 587 | // This does not change the NavigationController state. |
[email protected] | 10f417c5 | 2011-12-28 21:04:23 | [diff] [blame] | 588 | bool NavigateToEntry(const content::NavigationEntryImpl& entry, |
[email protected] | 71fde35 | 2011-12-29 03:29:56 | [diff] [blame] | 589 | content::NavigationController::ReloadType reload_type); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 590 | |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 591 | // Sets the history for this WebContentsImpl to |history_length| entries, and |
[email protected] | 796931a9 | 2011-08-10 01:32:14 | [diff] [blame] | 592 | // moves the current page_id to the last entry in the list if it's valid. |
| 593 | // This is mainly used when a prerendered page is swapped into the current |
[email protected] | 9e1ad4b | 2011-08-14 16:49:19 | [diff] [blame] | 594 | // tab. The method is virtual for testing. |
[email protected] | b658359 | 2012-01-25 19:52:33 | [diff] [blame] | 595 | virtual void SetHistoryLengthAndPrune( |
| 596 | const content::SiteInstance* site_instance, |
| 597 | int merge_history_length, |
| 598 | int32 minimum_page_id); |
[email protected] | 796931a9 | 2011-08-10 01:32:14 | [diff] [blame] | 599 | |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 600 | // Recursively creates swapped out RenderViews for this tab's opener chain |
| 601 | // (including this tab) in the given SiteInstance, allowing other tabs to send |
| 602 | // cross-process JavaScript calls to their opener(s). Returns the route ID of |
| 603 | // this tab's RenderView for |instance|. |
| 604 | int CreateOpenerRenderViews(content::SiteInstance* instance); |
| 605 | |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 606 | // Helper for CreateNewWidget/CreateNewFullscreenWidget. |
| 607 | void CreateNewWidget(int route_id, |
| 608 | bool is_fullscreen, |
| 609 | WebKit::WebPopupType popup_type); |
| 610 | |
| 611 | // Helper for ShowCreatedWidget/ShowCreatedFullscreenWidget. |
| 612 | void ShowCreatedWidget(int route_id, |
| 613 | bool is_fullscreen, |
| 614 | const gfx::Rect& initial_pos); |
| 615 | |
| 616 | // Finds the new RenderWidgetHost and returns it. Note that this can only be |
| 617 | // called once as this call also removes it from the internal map. |
| 618 | content::RenderWidgetHostView* GetCreatedWidget(int route_id); |
| 619 | |
| 620 | // Finds the new WebContentsImpl by route_id, initializes it for |
| 621 | // renderer-initiated creation, and returns it. Note that this can only be |
| 622 | // called once as this call also removes it from the internal map. |
| 623 | WebContentsImpl* GetCreatedWindow(int route_id); |
| 624 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 625 | // Misc non-view stuff ------------------------------------------------------- |
| 626 | |
| 627 | // Helper functions for sending notifications. |
| 628 | void NotifySwapped(); |
| 629 | void NotifyConnected(); |
| 630 | void NotifyDisconnected(); |
| 631 | |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 632 | void SetEncoding(const std::string& encoding); |
| 633 | |
[email protected] | 27678b2a | 2012-02-04 22:09:14 | [diff] [blame] | 634 | // Save a URL to the local filesystem. |
[email protected] | 20b433a | 2012-05-15 21:23:46 | [diff] [blame] | 635 | void SaveURL(const GURL& url, |
| 636 | const content::Referrer& referrer, |
| 637 | bool is_main_frame); |
[email protected] | 27678b2a | 2012-02-04 22:09:14 | [diff] [blame] | 638 | |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 639 | content::RenderViewHostImpl* GetRenderViewHostImpl(); |
[email protected] | 9f76c1e | 2012-03-05 15:15:58 | [diff] [blame] | 640 | |
[email protected] | 7900bfdb | 2012-05-24 19:31:24 | [diff] [blame] | 641 | void GetBrowserPluginEmbedderInfo(content::RenderViewHost* render_view_host, |
| 642 | std::string* embedder_channel_name, |
| 643 | int* embedder_container_id); |
| 644 | |
[email protected] | 8189899 | 2011-06-14 22:15:00 | [diff] [blame] | 645 | // Stores random bits of data for others to associate with this object. |
| 646 | // WARNING: this needs to be deleted after NavigationController. |
[email protected] | 45644f6 | 2011-11-23 00:58:23 | [diff] [blame] | 647 | base::PropertyBag property_bag_; |
[email protected] | 8189899 | 2011-06-14 22:15:00 | [diff] [blame] | 648 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 649 | // Data for core operation --------------------------------------------------- |
| 650 | |
| 651 | // Delegate for notifying our owner about stuff. Not owned by us. |
[email protected] | 674bc59 | 2011-12-20 23:00:42 | [diff] [blame] | 652 | content::WebContentsDelegate* delegate_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 653 | |
| 654 | // Handles the back/forward list and loading. |
[email protected] | d202a7c | 2012-01-04 07:53:47 | [diff] [blame] | 655 | NavigationControllerImpl controller_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 656 | |
| 657 | // The corresponding view. |
[email protected] | 8643e6d | 2012-01-18 20:26:10 | [diff] [blame] | 658 | scoped_ptr<content::WebContentsView> view_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 659 | |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 660 | // The view of the RVHD. Usually this is our WebContentsView implementation, |
| 661 | // but if an embedder uses a different WebContentsView, they'll need to |
| 662 | // provide this. |
| 663 | content::RenderViewHostDelegateView* render_view_host_delegate_view_; |
| 664 | |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 665 | // Tracks created WebContentsImpl objects that have not been shown yet. They |
| 666 | // are identified by the route ID passed to CreateNewWindow. |
| 667 | typedef std::map<int, WebContentsImpl*> PendingContents; |
| 668 | PendingContents pending_contents_; |
| 669 | |
| 670 | // These maps hold on to the widgets that we created on behalf of the renderer |
| 671 | // that haven't shown yet. |
| 672 | typedef std::map<int, content::RenderWidgetHostView*> PendingWidgetViews; |
| 673 | PendingWidgetViews pending_widget_views_; |
| 674 | |
[email protected] | 99604297 | 2011-11-08 22:43:59 | [diff] [blame] | 675 | // A list of observers notified when page state changes. Weak references. |
| 676 | // This MUST be listed above render_manager_ since at destruction time the |
| 677 | // latter might cause RenderViewHost's destructor to call us and we might use |
| 678 | // the observer list then. |
[email protected] | d8c66043 | 2011-12-22 20:51:25 | [diff] [blame] | 679 | ObserverList<content::WebContentsObserver> observers_; |
[email protected] | 99604297 | 2011-11-08 22:43:59 | [diff] [blame] | 680 | |
[email protected] | 14392a5 | 2012-05-02 20:28:44 | [diff] [blame] | 681 | // The tab that opened this tab, if any. Will be set to null if the opener |
| 682 | // is closed. |
| 683 | WebContentsImpl* opener_; |
| 684 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 685 | // Helper classes ------------------------------------------------------------ |
| 686 | |
| 687 | // Manages creation and swapping of render views. |
| 688 | RenderViewHostManager render_manager_; |
| 689 | |
[email protected] | 483623eb | 2011-10-25 09:30:00 | [diff] [blame] | 690 | // Manages injecting Java objects into all RenderViewHosts associated with |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 691 | // this WebContentsImpl. |
[email protected] | 483623eb | 2011-10-25 09:30:00 | [diff] [blame] | 692 | scoped_ptr<JavaBridgeDispatcherHostManager> |
| 693 | java_bridge_dispatcher_host_manager_; |
| 694 | |
[email protected] | dd26779c | 2012-08-08 01:50:28 | [diff] [blame] | 695 | // TODO(fsamuel): Remove this once upstreaming of the new browser plugin |
| 696 | // implmentation is complete. |
[email protected] | 172cf71 | 2012-05-23 15:07:39 | [diff] [blame] | 697 | // Manages the browser plugin instances hosted by this WebContents. |
[email protected] | dd26779c | 2012-08-08 01:50:28 | [diff] [blame] | 698 | scoped_ptr<content::old::BrowserPluginHost> old_browser_plugin_host_; |
[email protected] | 172cf71 | 2012-05-23 15:07:39 | [diff] [blame] | 699 | |
[email protected] | c7dd2f6 | 2011-07-18 15:57:59 | [diff] [blame] | 700 | // SavePackage, lazily created. |
| 701 | scoped_refptr<SavePackage> save_package_; |
| 702 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 703 | // Data for loading state ---------------------------------------------------- |
| 704 | |
| 705 | // Indicates whether we're currently loading a resource. |
| 706 | bool is_loading_; |
| 707 | |
| 708 | // Indicates if the tab is considered crashed. |
| 709 | base::TerminationStatus crashed_status_; |
| 710 | int crashed_error_code_; |
| 711 | |
[email protected] | ca13a44 | 2012-04-17 14:00:12 | [diff] [blame] | 712 | // Whether this WebContents is waiting for a first-response for the |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 713 | // main resource of the page. This controls whether the throbber state is |
| 714 | // "waiting" or "loading." |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 715 | bool waiting_for_response_; |
| 716 | |
[email protected] | 74ce1ad | 2011-12-16 21:51:46 | [diff] [blame] | 717 | // Map of SiteInstance ID to max page ID for this tab. A page ID is specific |
| 718 | // to a given tab and SiteInstance, and must be valid for the lifetime of the |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 719 | // WebContentsImpl. |
[email protected] | 74ce1ad | 2011-12-16 21:51:46 | [diff] [blame] | 720 | std::map<int32, int32> max_page_ids_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 721 | |
| 722 | // System time at which the current load was started. |
| 723 | base::TimeTicks current_load_start_; |
| 724 | |
| 725 | // The current load state and the URL associated with it. |
[email protected] | 9c235f04 | 2011-08-10 22:28:21 | [diff] [blame] | 726 | net::LoadStateWithParam load_state_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 727 | string16 load_state_host_; |
| 728 | // Upload progress, for displaying in the status bar. |
| 729 | // Set to zero when there is no significant upload happening. |
| 730 | uint64 upload_size_; |
| 731 | uint64 upload_position_; |
| 732 | |
| 733 | // Data for current page ----------------------------------------------------- |
| 734 | |
[email protected] | 987fc3a | 2011-05-26 14:18:09 | [diff] [blame] | 735 | // When a title cannot be taken from any entry, this title will be used. |
| 736 | string16 page_title_when_no_navigation_entry_; |
| 737 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 738 | // When a navigation occurs, we record its contents MIME type. It can be |
| 739 | // used to check whether we can do something for some special contents. |
| 740 | std::string contents_mime_type_; |
| 741 | |
| 742 | // Character encoding. |
| 743 | std::string encoding_; |
| 744 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 745 | // True if this is a secure page which displayed insecure content. |
| 746 | bool displayed_insecure_content_; |
| 747 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 748 | // Data for misc internal state ---------------------------------------------- |
| 749 | |
[email protected] | ca13a44 | 2012-04-17 14:00:12 | [diff] [blame] | 750 | // Whether the WebContents is currently being screenshotted. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 751 | bool capturing_contents_; |
| 752 | |
| 753 | // See getter above. |
| 754 | bool is_being_destroyed_; |
| 755 | |
| 756 | // Indicates whether we should notify about disconnection of this |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 757 | // WebContentsImpl. This is used to ensure disconnection notifications only |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 758 | // happen if a connection notification has happened and that they happen only |
| 759 | // once. |
| 760 | bool notify_disconnection_; |
| 761 | |
[email protected] | 2e5b90c | 2011-08-16 21:11:55 | [diff] [blame] | 762 | // Pointer to the JavaScript dialog creator, lazily assigned. Used because the |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 763 | // delegate of this WebContentsImpl is nulled before its destructor is called. |
[email protected] | 2e5b90c | 2011-08-16 21:11:55 | [diff] [blame] | 764 | content::JavaScriptDialogCreator* dialog_creator_; |
| 765 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 766 | #if defined(OS_WIN) |
| 767 | // Handle to an event that's set when the page is showing a message box (or |
| 768 | // equivalent constrained window). Plugin processes check this to know if |
| 769 | // they should pump messages then. |
| 770 | base::win::ScopedHandle message_box_active_; |
| 771 | #endif |
| 772 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 773 | // Set to true when there is an active "before unload" dialog. When true, |
| 774 | // we've forced the throbber to start in Navigate, and we need to remember to |
| 775 | // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled. |
| 776 | bool is_showing_before_unload_dialog_; |
| 777 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 778 | // Settings that get passed to the renderer process. |
[email protected] | daf82f8 | 2011-10-31 22:35:31 | [diff] [blame] | 779 | content::RendererPreferences renderer_preferences_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 780 | |
| 781 | // If this tab was created from a renderer using window.open, this will be |
| 782 | // non-NULL and represent the WebUI of the opening renderer. |
[email protected] | 01ec4ec | 2012-01-18 04:13:47 | [diff] [blame] | 783 | content::WebUI::TypeID opener_web_ui_type_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 784 | |
| 785 | // The time that we started to create the new tab page. |
| 786 | base::TimeTicks new_tab_start_time_; |
| 787 | |
[email protected] | 3bbacc5b | 2012-04-17 17:46:15 | [diff] [blame] | 788 | // The time that we started to close this WebContents. |
| 789 | base::TimeTicks close_start_time_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 790 | |
| 791 | // The time that this tab was last selected. |
| 792 | base::TimeTicks last_selected_time_; |
| 793 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 794 | // See description above setter. |
| 795 | bool closed_by_user_gesture_; |
| 796 | |
| 797 | // Minimum/maximum zoom percent. |
| 798 | int minimum_zoom_percent_; |
| 799 | int maximum_zoom_percent_; |
| 800 | // If true, the default zoom limits have been overriden for this tab, in which |
| 801 | // case we don't want saved settings to apply to it and we don't want to |
| 802 | // remember it. |
| 803 | bool temporary_zoom_settings_; |
| 804 | |
[email protected] | bcd281560 | 2012-01-14 18:17:23 | [diff] [blame] | 805 | // The intrinsic size of the page. |
| 806 | gfx::Size preferred_size_; |
| 807 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 808 | // Content restrictions, used to disable print/copy etc based on content's |
| 809 | // (full-page plugins for now only) permissions. |
| 810 | int content_restrictions_; |
| 811 | |
[email protected] | da854376 | 2012-03-20 08:52:20 | [diff] [blame] | 812 | // Color chooser that was opened by this tab. |
| 813 | content::ColorChooser* color_chooser_; |
| 814 | |
[email protected] | f53a9f87 | 2012-05-24 02:07:06 | [diff] [blame] | 815 | // This must be at the end, or else we might get notifications and use other |
| 816 | // member variables that are gone. |
| 817 | content::NotificationRegistrar registrar_; |
| 818 | |
[email protected] | 7bb76189 | 2012-07-20 09:32:47 | [diff] [blame] | 819 | // Used during IPC message dispatching so that the handlers can get a pointer |
| 820 | // to the RVH through which the message was received. |
| 821 | content::RenderViewHost* message_source_; |
| 822 | |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 823 | DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 824 | }; |
| 825 | |
[email protected] | 93ddb3c | 2012-04-11 21:44:29 | [diff] [blame] | 826 | #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |