blob: 89f5db8c17d8385c0efaa01992ffb60da65810e8 [file] [log] [blame]
[email protected]91854cd2012-01-10 19:43:571// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]0dd3a0ab2011-02-18 08:17:442// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]93ddb3c2012-04-11 21:44:295#ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
6#define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
[email protected]0dd3a0ab2011-02-18 08:17:447#pragma once
8
[email protected]0dd3a0ab2011-02-18 08:17:449#include <map>
10#include <string>
[email protected]0dd3a0ab2011-02-18 08:17:4411
[email protected]01d65172011-12-25 04:39:3012#include "base/compiler_specific.h"
[email protected]0dd3a0ab2011-02-18 08:17:4413#include "base/gtest_prod_util.h"
[email protected]3b63f8f42011-03-28 01:54:1514#include "base/memory/scoped_ptr.h"
[email protected]6eac57a2011-07-12 21:15:0915#include "base/observer_list.h"
[email protected]45644f62011-11-23 00:58:2316#include "base/property_bag.h"
[email protected]07161902011-11-11 09:57:4217#include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.h"
[email protected]4ca76c02012-05-16 16:19:0518#include "content/browser/renderer_host/render_widget_host_delegate.h"
[email protected]f9e4dae2012-04-10 21:26:3719#include "content/browser/web_contents/navigation_controller_impl.h"
[email protected]0c4e92e62012-04-11 15:19:0020#include "content/browser/web_contents/render_view_host_manager.h"
[email protected]8d128d62011-09-13 22:11:5721#include "content/common/content_export.h"
[email protected]14392a52012-05-02 20:28:4422#include "content/public/browser/notification_observer.h"
23#include "content/public/browser/notification_registrar.h"
[email protected]b0b67cf2012-01-18 21:59:5724#include "content/public/browser/render_view_host_delegate.h"
[email protected]58f5d562011-12-20 17:13:0325#include "content/public/browser/web_contents.h"
[email protected]daf82f82011-10-31 22:35:3126#include "content/public/common/renderer_preferences.h"
[email protected]0dd3a0ab2011-02-18 08:17:4427#include "net/base/load_states.h"
[email protected]bcd2815602012-01-14 18:17:2328#include "ui/gfx/size.h"
[email protected]70435962011-08-02 20:13:2829#include "webkit/glue/resource_type.h"
[email protected]0dd3a0ab2011-02-18 08:17:4430
31#if defined(OS_WIN)
32#include "base/win/scoped_handle.h"
33#endif
34
[email protected]cadaec52012-02-08 21:53:1335class InterstitialPageImpl;
[email protected]a53209b2012-01-20 16:48:1636class SavePackage;
[email protected]adbfb8df2012-02-24 01:19:4337class SessionStorageNamespaceImpl;
[email protected]f66df822012-05-18 16:52:1738class WebContentsImpl;
[email protected]f546640b2012-05-15 00:03:4939struct ViewMsg_PostMessage_Params;
[email protected]daf82f82011-10-31 22:35:3140
[email protected]e582fdd2011-12-20 16:48:1741namespace content {
[email protected]da8543762012-03-20 08:52:2042class ColorChooser;
[email protected]e582fdd2011-12-20 16:48:1743class DownloadItem;
[email protected]51da7e32012-01-30 19:24:5244class JavaScriptDialogCreator;
[email protected]eaabba22012-03-07 15:02:1145class RenderViewHost;
46class RenderViewHostImpl;
[email protected]09d31d52012-03-11 22:30:2747class SiteInstance;
[email protected]80e776ae2012-03-23 16:17:2048class TestWebContents;
[email protected]674bc592011-12-20 23:00:4249class WebContentsDelegate;
[email protected]51da7e32012-01-30 19:24:5250class WebContentsObserver;
[email protected]8643e6d2012-01-18 20:26:1051class WebContentsView;
[email protected]f66df822012-05-18 16:52:1752class WebContentsViewDelegate;
[email protected]09d31d52012-03-11 22:30:2753struct LoadNotificationDetails;
[email protected]f66df822012-05-18 16:52:1754
55// Factory function for the implementations that content knows about. Takes
56// ownership of |delegate|.
57WebContentsView* CreateWebContentsView(WebContentsImpl* web_contents,
58 WebContentsViewDelegate* delegate);
[email protected]e582fdd2011-12-20 16:48:1759}
60
[email protected]daf82f82011-10-31 22:35:3161namespace webkit_glue {
62struct WebIntentData;
63}
[email protected]0dd3a0ab2011-02-18 08:17:4464
[email protected]b172aee2012-04-10 17:05:2665class CONTENT_EXPORT WebContentsImpl
[email protected]01d65172011-12-25 04:39:3066 : public NON_EXPORTED_BASE(content::WebContents),
[email protected]b0b67cf2012-01-18 21:59:5767 public content::RenderViewHostDelegate,
[email protected]4ca76c02012-05-16 16:19:0568 public content::RenderWidgetHostDelegate,
[email protected]14392a52012-05-02 20:28:4469 public RenderViewHostManager::Delegate,
70 public content::NotificationObserver {
[email protected]0dd3a0ab2011-02-18 08:17:4471 public:
[email protected]a81343d232011-12-27 07:39:2072 // See WebContents::Create for a description of these parameters.
[email protected]b172aee2012-04-10 17:05:2673 WebContentsImpl(content::BrowserContext* browser_context,
74 content::SiteInstance* site_instance,
75 int routing_id,
76 const WebContentsImpl* base_web_contents,
[email protected]14392a52012-05-02 20:28:4477 WebContentsImpl* opener,
[email protected]b172aee2012-04-10 17:05:2678 SessionStorageNamespaceImpl* session_storage_namespace);
79 virtual ~WebContentsImpl();
[email protected]0dd3a0ab2011-02-18 08:17:4480
[email protected]64d69de42012-02-06 00:19:5481 // Returns the content specific prefs for the given RVH.
[email protected]6717bf272012-05-11 23:31:2582 static webkit_glue::WebPreferences GetWebkitPrefs(
[email protected]eaabba22012-03-07 15:02:1183 content::RenderViewHost* rvh, const GURL& url);
[email protected]64d69de42012-02-06 00:19:5484
[email protected]c7dd2f62011-07-18 15:57:5985 // Returns the SavePackage which manages the page saving job. May be NULL.
86 SavePackage* save_package() const { return save_package_.get(); }
87
[email protected]b172aee2012-04-10 17:05:2688 // Updates the max page ID for the current SiteInstance in this
89 // WebContentsImpl to be at least |page_id|.
[email protected]0dd3a0ab2011-02-18 08:17:4490 void UpdateMaxPageID(int32 page_id);
91
[email protected]b172aee2012-04-10 17:05:2692 // Updates the max page ID for the given SiteInstance in this WebContentsImpl
[email protected]74ce1ad2011-12-16 21:51:4693 // to be at least |page_id|.
[email protected]b6583592012-01-25 19:52:3394 void UpdateMaxPageIDForSiteInstance(content::SiteInstance* site_instance,
[email protected]74ce1ad2011-12-16 21:51:4695 int32 page_id);
96
[email protected]91854cd2012-01-10 19:43:5797 // Copy the current map of SiteInstance ID to max page ID from another tab.
98 // This is necessary when this tab adopts the NavigationEntries from
[email protected]b172aee2012-04-10 17:05:2699 // |web_contents|.
100 void CopyMaxPageIDsFrom(WebContentsImpl* web_contents);
[email protected]91854cd2012-01-10 19:43:57101
[email protected]b172aee2012-04-10 17:05:26102 // Called by the NavigationController to cause the WebContentsImpl to navigate
103 // to the current pending entry. The NavigationController should be called
104 // back with RendererDidNavigate on success or DiscardPendingEntry on failure.
[email protected]9a7e68c2011-05-26 17:35:50105 // The callbacks can be inside of this function, or at some future time.
[email protected]0dd3a0ab2011-02-18 08:17:44106 //
107 // The entry has a PageID of -1 if newly created (corresponding to navigation
108 // to a new URL).
109 //
110 // If this method returns false, then the navigation is discarded (equivalent
111 // to calling DiscardPendingEntry on the NavigationController).
[email protected]0bfbf882011-12-22 18:19:27112 bool NavigateToPendingEntry(
[email protected]71fde352011-12-29 03:29:56113 content::NavigationController::ReloadType reload_type);
[email protected]0dd3a0ab2011-02-18 08:17:44114
[email protected]ba45bfd2012-05-22 21:51:44115 // Called by InterstitialPageImpl when it creates a RenderViewHost.
116 void RenderViewForInterstitialPageCreated(
117 content::RenderViewHost* render_view_host);
118
[email protected]0dd3a0ab2011-02-18 08:17:44119 // Sets the passed passed interstitial as the currently showing interstitial.
120 // |interstitial_page| should be non NULL (use the remove_interstitial_page
121 // method to unset the interstitial) and no interstitial page should be set
122 // when there is already a non NULL interstitial page set.
[email protected]cadaec52012-02-08 21:53:13123 void set_interstitial_page(InterstitialPageImpl* interstitial_page) {
[email protected]0dd3a0ab2011-02-18 08:17:44124 render_manager_.set_interstitial_page(interstitial_page);
125 }
126
127 // Unsets the currently showing interstitial.
128 void remove_interstitial_page() {
129 render_manager_.remove_interstitial_page();
130 }
131
[email protected]01ec4ec2012-01-18 04:13:47132 void set_opener_web_ui_type(content::WebUI::TypeID opener_web_ui_type) {
[email protected]0dd3a0ab2011-02-18 08:17:44133 opener_web_ui_type_ = opener_web_ui_type;
134 }
135
[email protected]276b37a22011-11-08 20:45:46136 JavaBridgeDispatcherHostManager* java_bridge_dispatcher_host_manager() const {
137 return java_bridge_dispatcher_host_manager_.get();
138 }
139
[email protected]cdcb1dee2012-01-04 00:46:20140 // Like GetController from WebContents, but returns the concrete object.
[email protected]d202a7c2012-01-04 07:53:47141 NavigationControllerImpl& GetControllerImpl();
[email protected]cdcb1dee2012-01-04 00:46:20142
[email protected]765187182012-01-11 23:59:28143 // Expose the render manager for testing.
144 RenderViewHostManager* GetRenderManagerForTesting();
145
[email protected]58f5d562011-12-20 17:13:03146 // content::WebContents ------------------------------------------------------
[email protected]6934a702011-12-20 00:04:51147 virtual const base::PropertyBag* GetPropertyBag() const OVERRIDE;
148 virtual base::PropertyBag* GetPropertyBag() OVERRIDE;
[email protected]674bc592011-12-20 23:00:42149 virtual content::WebContentsDelegate* GetDelegate() OVERRIDE;
150 virtual void SetDelegate(content::WebContentsDelegate* delegate) OVERRIDE;
[email protected]cdcb1dee2012-01-04 00:46:20151 virtual content::NavigationController& GetController() OVERRIDE;
152 virtual const content::NavigationController& GetController() const OVERRIDE;
[email protected]627e0512011-12-21 22:55:30153 virtual content::BrowserContext* GetBrowserContext() const OVERRIDE;
[email protected]f5fa20e2011-12-21 22:35:56154 virtual void SetViewType(content::ViewType type) OVERRIDE;
[email protected]ea049a02011-12-25 21:37:09155 virtual content::ViewType GetViewType() const OVERRIDE;
[email protected]f5fa20e2011-12-21 22:35:56156 virtual content::RenderProcessHost* GetRenderProcessHost() const OVERRIDE;
[email protected]eaabba22012-03-07 15:02:11157 virtual content::RenderViewHost* GetRenderViewHost() const OVERRIDE;
[email protected]5626b0892012-02-20 14:46:58158 virtual content::RenderWidgetHostView*
159 GetRenderWidgetHostView() const OVERRIDE;
[email protected]8643e6d2012-01-18 20:26:10160 virtual content::WebContentsView* GetView() const OVERRIDE;
[email protected]01ec4ec2012-01-18 04:13:47161 virtual content::WebUI* CreateWebUI(const GURL& url) OVERRIDE;
162 virtual content::WebUI* GetWebUI() const OVERRIDE;
163 virtual content::WebUI* GetCommittedWebUI() const OVERRIDE;
[email protected]86ef6a392012-05-11 22:03:11164 virtual void SetUserAgentOverride(const std::string& override) OVERRIDE;
165 virtual const std::string& GetUserAgentOverride() const OVERRIDE;
[email protected]be1f56ab2011-12-22 06:55:31166 virtual const string16& GetTitle() const OVERRIDE;
167 virtual int32 GetMaxPageID() OVERRIDE;
168 virtual int32 GetMaxPageIDForSiteInstance(
[email protected]b6583592012-01-25 19:52:33169 content::SiteInstance* site_instance) OVERRIDE;
170 virtual content::SiteInstance* GetSiteInstance() const OVERRIDE;
171 virtual content::SiteInstance* GetPendingSiteInstance() const OVERRIDE;
[email protected]be1f56ab2011-12-22 06:55:31172 virtual bool IsLoading() const OVERRIDE;
173 virtual bool IsWaitingForResponse() const OVERRIDE;
174 virtual const net::LoadStateWithParam& GetLoadState() const OVERRIDE;
175 virtual const string16& GetLoadStateHost() const OVERRIDE;
176 virtual uint64 GetUploadSize() const OVERRIDE;
177 virtual uint64 GetUploadPosition() const OVERRIDE;
178 virtual const std::string& GetEncoding() const OVERRIDE;
179 virtual bool DisplayedInsecureContent() const OVERRIDE;
180 virtual void SetCapturingContents(bool cap) OVERRIDE;
181 virtual bool IsCrashed() const OVERRIDE;
182 virtual void SetIsCrashed(base::TerminationStatus status,
183 int error_code) OVERRIDE;
184 virtual base::TerminationStatus GetCrashedStatus() const OVERRIDE;
185 virtual bool IsBeingDestroyed() const OVERRIDE;
186 virtual void NotifyNavigationStateChanged(unsigned changed_flags) OVERRIDE;
187 virtual void DidBecomeSelected() OVERRIDE;
188 virtual base::TimeTicks GetLastSelectedTime() const OVERRIDE;
189 virtual void WasHidden() OVERRIDE;
190 virtual void ShowContents() OVERRIDE;
191 virtual void HideContents() OVERRIDE;
192 virtual bool NeedToFireBeforeUnload() OVERRIDE;
[email protected]0bfbf882011-12-22 18:19:27193 virtual void Stop() OVERRIDE;
[email protected]d9083482012-01-06 00:38:46194 virtual content::WebContents* Clone() OVERRIDE;
[email protected]2a6bc3e2011-12-28 23:51:33195 virtual void AddNewContents(content::WebContents* new_contents,
[email protected]0bfbf882011-12-22 18:19:27196 WindowOpenDisposition disposition,
197 const gfx::Rect& initial_pos,
198 bool user_gesture) OVERRIDE;
199 virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
200 virtual gfx::NativeView GetNativeView() const OVERRIDE;
201 virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE;
202 virtual void Focus() OVERRIDE;
203 virtual void FocusThroughTabTraversal(bool reverse) OVERRIDE;
204 virtual bool ShowingInterstitialPage() const OVERRIDE;
[email protected]cadaec52012-02-08 21:53:13205 virtual content::InterstitialPage* GetInterstitialPage() const OVERRIDE;
[email protected]a53209b2012-01-20 16:48:16206 virtual bool IsSavable() OVERRIDE;
[email protected]0bfbf882011-12-22 18:19:27207 virtual void OnSavePage() OVERRIDE;
208 virtual bool SavePage(const FilePath& main_file,
209 const FilePath& dir_path,
[email protected]a53209b2012-01-20 16:48:16210 content::SavePageType save_type) OVERRIDE;
[email protected]aa4f3972012-03-01 18:12:12211 virtual void GenerateMHTML(
212 const FilePath& file,
213 const base::Callback<void(const FilePath&, int64)>& callback) OVERRIDE;
[email protected]0bfbf882011-12-22 18:19:27214 virtual bool IsActiveEntry(int32 page_id) OVERRIDE;
215
216 virtual const std::string& GetContentsMimeType() const OVERRIDE;
217 virtual bool WillNotifyDisconnection() const OVERRIDE;
218 virtual void SetOverrideEncoding(const std::string& encoding) OVERRIDE;
219 virtual void ResetOverrideEncoding() OVERRIDE;
220 virtual content::RendererPreferences* GetMutableRendererPrefs() OVERRIDE;
221 virtual void SetNewTabStartTime(const base::TimeTicks& time) OVERRIDE;
222 virtual base::TimeTicks GetNewTabStartTime() const OVERRIDE;
223 virtual void OnCloseStarted() OVERRIDE;
224 virtual bool ShouldAcceptDragAndDrop() const OVERRIDE;
225 virtual void SystemDragEnded() OVERRIDE;
226 virtual void SetClosedByUserGesture(bool value) OVERRIDE;
227 virtual bool GetClosedByUserGesture() const OVERRIDE;
228 virtual double GetZoomLevel() const OVERRIDE;
229 virtual int GetZoomPercent(bool* enable_increment,
230 bool* enable_decrement) OVERRIDE;
231 virtual void ViewSource() OVERRIDE;
232 virtual void ViewFrameSource(const GURL& url,
233 const std::string& content_state) OVERRIDE;
234 virtual int GetMinimumZoomPercent() const OVERRIDE;
235 virtual int GetMaximumZoomPercent() const OVERRIDE;
[email protected]bcd2815602012-01-14 18:17:23236 virtual gfx::Size GetPreferredSize() const OVERRIDE;
[email protected]0bfbf882011-12-22 18:19:27237 virtual int GetContentRestrictions() const OVERRIDE;
[email protected]01ec4ec2012-01-18 04:13:47238 virtual content::WebUI::TypeID GetWebUITypeForCurrentState() OVERRIDE;
239 virtual content::WebUI* GetWebUIForCurrentState() OVERRIDE;
[email protected]0bfbf882011-12-22 18:19:27240 virtual bool GotResponseToLockMouseRequest(bool allowed) OVERRIDE;
[email protected]a0358d72012-03-09 14:06:50241 virtual bool HasOpener() const OVERRIDE;
[email protected]da8543762012-03-20 08:52:20242 virtual void DidChooseColorInColorChooser(int color_chooser_id,
[email protected]55578b0a2012-04-18 14:31:32243 SkColor color) OVERRIDE;
[email protected]da8543762012-03-20 08:52:20244 virtual void DidEndColorChooser(int color_chooser_id) OVERRIDE;
[email protected]0bfbf882011-12-22 18:19:27245
246 // Implementation of PageNavigator.
[email protected]e5d549d2011-12-28 01:29:20247 virtual content::WebContents* OpenURL(
248 const content::OpenURLParams& params) OVERRIDE;
[email protected]151a63d2011-12-20 22:32:52249
[email protected]952a68e2011-11-17 00:36:10250 // RenderViewHostDelegate ----------------------------------------------------
251
[email protected]b0b67cf2012-01-18 21:59:57252 virtual content::RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE;
253 virtual content::RenderViewHostDelegate::RendererManagement*
[email protected]952a68e2011-11-17 00:36:10254 GetRendererManagementDelegate() OVERRIDE;
[email protected]be1f56ab2011-12-22 06:55:31255 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
256 virtual const GURL& GetURL() const OVERRIDE;
[email protected]768c5472011-12-26 19:06:17257 virtual WebContents* GetAsWebContents() OVERRIDE;
[email protected]952a68e2011-11-17 00:36:10258 virtual content::ViewType GetRenderViewType() const OVERRIDE;
[email protected]b7a756d42012-01-23 18:08:17259 virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE;
[email protected]eaabba22012-03-07 15:02:11260 virtual void RenderViewCreated(
261 content::RenderViewHost* render_view_host) OVERRIDE;
262 virtual void RenderViewReady(
263 content::RenderViewHost* render_view_host) OVERRIDE;
264 virtual void RenderViewGone(content::RenderViewHost* render_view_host,
[email protected]952a68e2011-11-17 00:36:10265 base::TerminationStatus status,
266 int error_code) OVERRIDE;
[email protected]eaabba22012-03-07 15:02:11267 virtual void RenderViewDeleted(
268 content::RenderViewHost* render_view_host) OVERRIDE;
[email protected]54047eb52012-05-08 21:45:57269 virtual void DidStartProvisionalLoadForFrame(
270 content::RenderViewHost* render_view_host,
271 int64 frame_id,
272 bool main_frame,
273 const GURL& opener_url,
274 const GURL& url) OVERRIDE;
275 virtual void DidRedirectProvisionalLoad(
276 content::RenderViewHost* render_view_host,
277 int32 page_id,
278 const GURL& opener_url,
279 const GURL& source_url,
280 const GURL& target_url) OVERRIDE;
281 virtual void DidFailProvisionalLoadWithError(
282 content::RenderViewHost* render_view_host,
283 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params)
284 OVERRIDE;
[email protected]952a68e2011-11-17 00:36:10285 virtual void DidNavigate(
[email protected]eaabba22012-03-07 15:02:11286 content::RenderViewHost* render_view_host,
[email protected]952a68e2011-11-17 00:36:10287 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
[email protected]eaabba22012-03-07 15:02:11288 virtual void UpdateState(content::RenderViewHost* render_view_host,
[email protected]952a68e2011-11-17 00:36:10289 int32 page_id,
290 const std::string& state) OVERRIDE;
[email protected]eaabba22012-03-07 15:02:11291 virtual void UpdateTitle(content::RenderViewHost* render_view_host,
[email protected]952a68e2011-11-17 00:36:10292 int32 page_id,
293 const string16& title,
294 base::i18n::TextDirection title_direction) OVERRIDE;
[email protected]eaabba22012-03-07 15:02:11295 virtual void UpdateEncoding(content::RenderViewHost* render_view_host,
[email protected]952a68e2011-11-17 00:36:10296 const std::string& encoding) OVERRIDE;
297 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE;
[email protected]eaabba22012-03-07 15:02:11298 virtual void Close(content::RenderViewHost* render_view_host) OVERRIDE;
[email protected]952a68e2011-11-17 00:36:10299 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE;
[email protected]eaabba22012-03-07 15:02:11300 virtual void SwappedOut(content::RenderViewHost* render_view_host) OVERRIDE;
[email protected]952a68e2011-11-17 00:36:10301 virtual void DidStartLoading() OVERRIDE;
302 virtual void DidStopLoading() OVERRIDE;
303 virtual void DidCancelLoading() OVERRIDE;
304 virtual void DidChangeLoadProgress(double progress) OVERRIDE;
[email protected]87717d0e2012-04-26 02:58:43305 virtual void DocumentAvailableInMainFrame(
306 content::RenderViewHost* render_view_host) OVERRIDE;
[email protected]952a68e2011-11-17 00:36:10307 virtual void DocumentOnLoadCompletedInMainFrame(
[email protected]eaabba22012-03-07 15:02:11308 content::RenderViewHost* render_view_host,
[email protected]952a68e2011-11-17 00:36:10309 int32 page_id) OVERRIDE;
[email protected]196159d2012-05-04 17:26:54310 virtual void RequestOpenURL(content::RenderViewHost* rvh,
311 const GURL& url,
[email protected]445e1042011-12-03 21:03:15312 const content::Referrer& referrer,
[email protected]952a68e2011-11-17 00:36:10313 WindowOpenDisposition disposition,
314 int64 source_frame_id) OVERRIDE;
[email protected]4ad5d77d2011-12-03 02:00:48315 virtual void RequestTransferURL(
316 const GURL& url,
[email protected]bce1f1c2011-12-05 15:11:58317 const content::Referrer& referrer,
[email protected]4ad5d77d2011-12-03 02:00:48318 WindowOpenDisposition disposition,
319 int64 source_frame_id,
[email protected]e5d549d2011-12-28 01:29:20320 const content::GlobalRequestID& transferred_global_request_id) OVERRIDE;
[email protected]e1c3a552012-05-04 20:51:32321 virtual void RouteCloseEvent(content::RenderViewHost* rvh) OVERRIDE;
[email protected]f546640b2012-05-15 00:03:49322 virtual void RouteMessageEvent(
323 content::RenderViewHost* rvh,
324 const ViewMsg_PostMessage_Params& params) OVERRIDE;
[email protected]eaabba22012-03-07 15:02:11325 virtual void RunJavaScriptMessage(content::RenderViewHost* rvh,
[email protected]952a68e2011-11-17 00:36:10326 const string16& message,
327 const string16& default_prompt,
328 const GURL& frame_url,
[email protected]269f86d2011-12-07 02:43:47329 ui::JavascriptMessageType type,
[email protected]952a68e2011-11-17 00:36:10330 IPC::Message* reply_msg,
331 bool* did_suppress_message) OVERRIDE;
[email protected]eaabba22012-03-07 15:02:11332 virtual void RunBeforeUnloadConfirm(content::RenderViewHost* rvh,
[email protected]952a68e2011-11-17 00:36:10333 const string16& message,
[email protected]3b3301f62012-02-29 04:32:32334 bool is_reload,
[email protected]952a68e2011-11-17 00:36:10335 IPC::Message* reply_msg) OVERRIDE;
336 virtual content::RendererPreferences GetRendererPrefs(
337 content::BrowserContext* browser_context) const OVERRIDE;
[email protected]6717bf272012-05-11 23:31:25338 virtual webkit_glue::WebPreferences GetWebkitPrefs() OVERRIDE;
[email protected]952a68e2011-11-17 00:36:10339 virtual void OnUserGesture() OVERRIDE;
340 virtual void OnIgnoredUIEvent() OVERRIDE;
[email protected]eaabba22012-03-07 15:02:11341 virtual void RendererUnresponsive(content::RenderViewHost* render_view_host,
[email protected]952a68e2011-11-17 00:36:10342 bool is_during_unload) OVERRIDE;
[email protected]eaabba22012-03-07 15:02:11343 virtual void RendererResponsive(
344 content::RenderViewHost* render_view_host) OVERRIDE;
[email protected]952a68e2011-11-17 00:36:10345 virtual void LoadStateChanged(const GURL& url,
346 const net::LoadStateWithParam& load_state,
347 uint64 upload_position,
348 uint64 upload_size) OVERRIDE;
349 virtual void WorkerCrashed() OVERRIDE;
350 virtual void Activate() OVERRIDE;
351 virtual void Deactivate() OVERRIDE;
352 virtual void LostCapture() OVERRIDE;
[email protected]952a68e2011-11-17 00:36:10353 virtual void HandleMouseDown() OVERRIDE;
354 virtual void HandleMouseUp() OVERRIDE;
355 virtual void HandleMouseActivate() OVERRIDE;
[email protected]edc64de2011-11-17 20:07:38356 virtual void RunFileChooser(
[email protected]eaabba22012-03-07 15:02:11357 content::RenderViewHost* render_view_host,
[email protected]8caadeb2011-11-22 02:45:23358 const content::FileChooserParams& params) OVERRIDE;
[email protected]952a68e2011-11-17 00:36:10359 virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE;
360 virtual bool IsFullscreenForCurrentTab() const OVERRIDE;
361 virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE;
[email protected]61e2b3cc2012-03-02 16:13:34362 virtual void ResizeDueToAutoResize(const gfx::Size& new_size) OVERRIDE;
[email protected]42252e02012-04-26 16:29:39363 virtual void RequestToLockMouse(bool user_gesture) OVERRIDE;
[email protected]952a68e2011-11-17 00:36:10364 virtual void LostMouseLock() OVERRIDE;
365
[email protected]4ca76c02012-05-16 16:19:05366 // RenderWidgetHostDelegate --------------------------------------------------
367
[email protected]b87ee522012-05-18 15:16:54368 virtual bool PreHandleKeyboardEvent(
369 const content::NativeWebKeyboardEvent& event,
370 bool* is_keyboard_shortcut) OVERRIDE;
[email protected]4ca76c02012-05-16 16:19:05371 virtual void HandleKeyboardEvent(
[email protected]b87ee522012-05-18 15:16:54372 const content::NativeWebKeyboardEvent& event) OVERRIDE;
[email protected]4ca76c02012-05-16 16:19:05373
[email protected]0bfbf882011-12-22 18:19:27374 // RenderViewHostManager::Delegate -------------------------------------------
375
376 virtual bool CreateRenderViewForRenderManager(
[email protected]14392a52012-05-02 20:28:44377 content::RenderViewHost* render_view_host, int opener_route_id) OVERRIDE;
[email protected]0bfbf882011-12-22 18:19:27378 virtual void BeforeUnloadFiredFromRenderManager(
379 bool proceed,
380 bool* proceed_to_fire_unload) OVERRIDE;
381 virtual void DidStartLoadingFromRenderManager(
[email protected]eaabba22012-03-07 15:02:11382 content::RenderViewHost* render_view_host) OVERRIDE;
[email protected]0bfbf882011-12-22 18:19:27383 virtual void RenderViewGoneFromRenderManager(
[email protected]eaabba22012-03-07 15:02:11384 content::RenderViewHost* render_view_host) OVERRIDE;
[email protected]0bfbf882011-12-22 18:19:27385 virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE;
386 virtual void NotifySwappedFromRenderManager() OVERRIDE;
[email protected]14392a52012-05-02 20:28:44387 virtual int CreateOpenerRenderViewsForRenderManager(
388 content::SiteInstance* instance) OVERRIDE;
[email protected]d202a7c2012-01-04 07:53:47389 virtual NavigationControllerImpl& GetControllerForRenderManager() OVERRIDE;
[email protected]d2353452012-01-19 19:53:56390 virtual WebUIImpl* CreateWebUIForRenderManager(const GURL& url) OVERRIDE;
[email protected]ad23a092011-12-28 07:02:04391 virtual content::NavigationEntry*
[email protected]0bfbf882011-12-22 18:19:27392 GetLastCommittedNavigationEntryForRenderManager() OVERRIDE;
393 virtual bool FocusLocationBarByDefault() OVERRIDE;
394 virtual void SetFocusToLocationBar(bool select_all) OVERRIDE;
[email protected]eaabba22012-03-07 15:02:11395 virtual void CreateViewAndSetSizeForRVH(
396 content::RenderViewHost* rvh) OVERRIDE;
[email protected]0bfbf882011-12-22 18:19:27397
[email protected]14392a52012-05-02 20:28:44398 // content::NotificationObserver ---------------------------------------------
399
400 virtual void Observe(int type,
401 const content::NotificationSource& source,
402 const content::NotificationDetails& details) OVERRIDE;
403
[email protected]0dd3a0ab2011-02-18 08:17:44404 protected:
[email protected]d8c660432011-12-22 20:51:25405 friend class content::WebContentsObserver;
[email protected]553602e12011-04-05 17:01:18406
407 // Add and remove observers for page navigation notifications. Adding or
408 // removing multiple times has no effect. The order in which notifications
409 // are sent to observers is undefined. Clients must be sure to remove the
410 // observer before they go away.
[email protected]d8c660432011-12-22 20:51:25411 void AddObserver(content::WebContentsObserver* observer);
412 void RemoveObserver(content::WebContentsObserver* observer);
[email protected]553602e12011-04-05 17:01:18413
[email protected]0dd3a0ab2011-02-18 08:17:44414 private:
[email protected]d202a7c2012-01-04 07:53:47415 friend class NavigationControllerImpl;
[email protected]0dd3a0ab2011-02-18 08:17:44416
[email protected]2db9bd72012-04-13 20:20:56417 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials);
418 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle);
419 FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest,
420 CrossSiteCantPreemptAfterUnload);
[email protected]0dd3a0ab2011-02-18 08:17:44421 FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles);
422 FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate);
423 FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload);
424
[email protected]cadaec52012-02-08 21:53:13425 // So InterstitialPageImpl can access SetIsLoading.
426 friend class InterstitialPageImpl;
[email protected]0dd3a0ab2011-02-18 08:17:44427
[email protected]80e776ae2012-03-23 16:17:20428 // TODO(brettw) TestWebContents shouldn't exist!
429 friend class content::TestWebContents;
[email protected]0dd3a0ab2011-02-18 08:17:44430
[email protected]14392a52012-05-02 20:28:44431 // Clears this tab's opener if it has been closed.
432 void OnWebContentsDestroyed(content::WebContents* web_contents);
433
[email protected]51da7e32012-01-30 19:24:52434 // Callback function when showing JS dialogs.
[email protected]eaabba22012-03-07 15:02:11435 void OnDialogClosed(content::RenderViewHost* rvh,
[email protected]51da7e32012-01-30 19:24:52436 IPC::Message* reply_msg,
437 bool success,
438 const string16& user_input);
439
[email protected]d0759f492012-04-19 22:50:50440 // IPC message handlers.
[email protected]8b5af492011-11-28 21:50:58441 void OnRegisterIntentService(const string16& action,
[email protected]63c239322011-10-31 23:56:30442 const string16& type,
443 const string16& href,
444 const string16& title,
445 const string16& disposition);
[email protected]678105012011-12-09 04:01:21446 void OnWebIntentDispatch(const webkit_glue::WebIntentData& intent,
[email protected]63c239322011-10-31 23:56:30447 int intent_id);
[email protected]0dd3a0ab2011-02-18 08:17:44448 void OnDidLoadResourceFromMemoryCache(const GURL& url,
[email protected]70435962011-08-02 20:13:28449 const std::string& security_info,
450 const std::string& http_request,
451 ResourceType::Type resource_type);
[email protected]0dd3a0ab2011-02-18 08:17:44452 void OnDidDisplayInsecureContent();
453 void OnDidRunInsecureContent(const std::string& security_origin,
454 const GURL& target_url);
455 void OnDocumentLoadedInFrame(int64 frame_id);
[email protected]1a55c5be2011-11-29 11:36:31456 void OnDidFinishLoad(int64 frame_id,
457 const GURL& validated_url,
458 bool is_main_frame);
459 void OnDidFailLoadWithError(int64 frame_id,
460 const GURL& validated_url,
461 bool is_main_frame,
462 int error_code,
463 const string16& error_description);
[email protected]0dd3a0ab2011-02-18 08:17:44464 void OnUpdateContentRestrictions(int restrictions);
[email protected]0dd3a0ab2011-02-18 08:17:44465 void OnGoToEntryAtOffset(int offset);
[email protected]216813952011-05-19 22:21:26466 void OnUpdateZoomLimits(int minimum_percent,
467 int maximum_percent,
468 bool remember);
[email protected]20b433a2012-05-15 21:23:46469 void OnSaveURL(const GURL& url, const content::Referrer& referrer);
[email protected]3a29a6e2011-08-24 18:26:21470 void OnEnumerateDirectory(int request_id, const FilePath& path);
[email protected]7d189022011-08-25 22:54:20471 void OnJSOutOfMemory();
[email protected]b7a756d42012-01-23 18:08:17472
[email protected]7d189022011-08-25 22:54:20473 void OnRegisterProtocolHandler(const std::string& protocol,
474 const GURL& url,
475 const string16& title);
[email protected]b888919c2011-09-02 00:32:16476 void OnFindReply(int request_id, int number_of_matches,
477 const gfx::Rect& selection_rect, int active_match_ordinal,
478 bool final_update);
[email protected]d952a052011-09-06 18:42:45479 void OnCrashedPlugin(const FilePath& plugin_path);
[email protected]7fc4bbb2011-09-08 21:23:10480 void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy);
[email protected]55578b0a2012-04-18 14:31:32481 void OnOpenColorChooser(int color_chooser_id, SkColor color);
[email protected]da8543762012-03-20 08:52:20482 void OnEndColorChooser(int color_chooser_id);
[email protected]55578b0a2012-04-18 14:31:32483 void OnSetSelectedColorInColorChooser(int color_chooser_id, SkColor color);
[email protected]8be45842012-04-13 19:49:29484 void OnPepperPluginHung(int plugin_child_id,
485 const FilePath& path,
486 bool is_hung);
[email protected]d0759f492012-04-19 22:50:50487 void OnWebUISend(const GURL& source_url,
488 const std::string& name,
489 const base::ListValue& args);
[email protected]0dd3a0ab2011-02-18 08:17:44490
491 // Changes the IsLoading state and notifies delegate as needed
492 // |details| is used to provide details on the load that just finished
493 // (but can be null if not applicable). Can be overridden.
494 void SetIsLoading(bool is_loading,
[email protected]09d31d52012-03-11 22:30:27495 content::LoadNotificationDetails* details);
[email protected]0dd3a0ab2011-02-18 08:17:44496
[email protected]0dd3a0ab2011-02-18 08:17:44497 // Called by derived classes to indicate that we're no longer waiting for a
498 // response. This won't actually update the throbber, but it will get picked
499 // up at the next animation step if the throbber is going.
500 void SetNotWaitingForResponse() { waiting_for_response_ = false; }
501
[email protected]0dd3a0ab2011-02-18 08:17:44502 // Navigation helpers --------------------------------------------------------
503 //
504 // These functions are helpers for Navigate() and DidNavigate().
505
506 // Handles post-navigation tasks in DidNavigate AFTER the entry has been
507 // committed to the navigation controller. Note that the navigation entry is
508 // not provided since it may be invalid/changed after being committed. The
509 // current navigation entry is in the NavigationController at this point.
510 void DidNavigateMainFramePostCommit(
[email protected]8286f51a2011-05-31 17:39:13511 const content::LoadCommittedDetails& details,
[email protected]0dd3a0ab2011-02-18 08:17:44512 const ViewHostMsg_FrameNavigate_Params& params);
513 void DidNavigateAnyFramePostCommit(
[email protected]eaabba22012-03-07 15:02:11514 content::RenderViewHost* render_view_host,
[email protected]8286f51a2011-05-31 17:39:13515 const content::LoadCommittedDetails& details,
[email protected]0dd3a0ab2011-02-18 08:17:44516 const ViewHostMsg_FrameNavigate_Params& params);
517
[email protected]74ce1ad2011-12-16 21:51:46518 // If our controller was restored, update the max page ID associated with the
519 // given RenderViewHost to be larger than the number of restored entries.
520 // This is called in CreateRenderView before any navigations in the RenderView
521 // have begun, to prevent any races in updating RenderView::next_page_id.
[email protected]eaabba22012-03-07 15:02:11522 void UpdateMaxPageIDIfNecessary(content::RenderViewHost* rvh);
[email protected]0dd3a0ab2011-02-18 08:17:44523
[email protected]0dd3a0ab2011-02-18 08:17:44524 // Saves the given title to the navigation entry and does associated work. It
525 // will update history and the view for the new title, and also synthesize
526 // titles for file URLs that have none (so we require that the URL of the
527 // entry already be set).
528 //
529 // This is used as the backend for state updates, which include a new title,
530 // or the dedicated set title message. It returns true if the new title is
531 // different and was therefore updated.
[email protected]10f417c52011-12-28 21:04:23532 bool UpdateTitleForEntry(content::NavigationEntryImpl* entry,
533 const string16& title);
[email protected]0dd3a0ab2011-02-18 08:17:44534
[email protected]b172aee2012-04-10 17:05:26535 // Causes the WebContentsImpl to navigate in the right renderer to |entry|,
536 // which must be already part of the entries in the navigation controller.
[email protected]0dd3a0ab2011-02-18 08:17:44537 // This does not change the NavigationController state.
[email protected]10f417c52011-12-28 21:04:23538 bool NavigateToEntry(const content::NavigationEntryImpl& entry,
[email protected]71fde352011-12-29 03:29:56539 content::NavigationController::ReloadType reload_type);
[email protected]0dd3a0ab2011-02-18 08:17:44540
[email protected]b172aee2012-04-10 17:05:26541 // Sets the history for this WebContentsImpl to |history_length| entries, and
[email protected]796931a92011-08-10 01:32:14542 // moves the current page_id to the last entry in the list if it's valid.
543 // This is mainly used when a prerendered page is swapped into the current
[email protected]9e1ad4b2011-08-14 16:49:19544 // tab. The method is virtual for testing.
[email protected]b6583592012-01-25 19:52:33545 virtual void SetHistoryLengthAndPrune(
546 const content::SiteInstance* site_instance,
547 int merge_history_length,
548 int32 minimum_page_id);
[email protected]796931a92011-08-10 01:32:14549
[email protected]14392a52012-05-02 20:28:44550 // Recursively creates swapped out RenderViews for this tab's opener chain
551 // (including this tab) in the given SiteInstance, allowing other tabs to send
552 // cross-process JavaScript calls to their opener(s). Returns the route ID of
553 // this tab's RenderView for |instance|.
554 int CreateOpenerRenderViews(content::SiteInstance* instance);
555
[email protected]0dd3a0ab2011-02-18 08:17:44556 // Misc non-view stuff -------------------------------------------------------
557
558 // Helper functions for sending notifications.
559 void NotifySwapped();
560 void NotifyConnected();
561 void NotifyDisconnected();
562
[email protected]be1f56ab2011-12-22 06:55:31563 void SetEncoding(const std::string& encoding);
564
[email protected]27678b2a2012-02-04 22:09:14565 // Save a URL to the local filesystem.
[email protected]20b433a2012-05-15 21:23:46566 void SaveURL(const GURL& url,
567 const content::Referrer& referrer,
568 bool is_main_frame);
[email protected]27678b2a2012-02-04 22:09:14569
[email protected]eaabba22012-03-07 15:02:11570 content::RenderViewHostImpl* GetRenderViewHostImpl();
[email protected]9f76c1e2012-03-05 15:15:58571
[email protected]81898992011-06-14 22:15:00572 // Stores random bits of data for others to associate with this object.
573 // WARNING: this needs to be deleted after NavigationController.
[email protected]45644f62011-11-23 00:58:23574 base::PropertyBag property_bag_;
[email protected]81898992011-06-14 22:15:00575
[email protected]14392a52012-05-02 20:28:44576 // Listen for notifications as well.
577 content::NotificationRegistrar registrar_;
578
[email protected]0dd3a0ab2011-02-18 08:17:44579 // Data for core operation ---------------------------------------------------
580
581 // Delegate for notifying our owner about stuff. Not owned by us.
[email protected]674bc592011-12-20 23:00:42582 content::WebContentsDelegate* delegate_;
[email protected]0dd3a0ab2011-02-18 08:17:44583
584 // Handles the back/forward list and loading.
[email protected]d202a7c2012-01-04 07:53:47585 NavigationControllerImpl controller_;
[email protected]0dd3a0ab2011-02-18 08:17:44586
587 // The corresponding view.
[email protected]8643e6d2012-01-18 20:26:10588 scoped_ptr<content::WebContentsView> view_;
[email protected]0dd3a0ab2011-02-18 08:17:44589
[email protected]996042972011-11-08 22:43:59590 // A list of observers notified when page state changes. Weak references.
591 // This MUST be listed above render_manager_ since at destruction time the
592 // latter might cause RenderViewHost's destructor to call us and we might use
593 // the observer list then.
[email protected]d8c660432011-12-22 20:51:25594 ObserverList<content::WebContentsObserver> observers_;
[email protected]996042972011-11-08 22:43:59595
[email protected]14392a52012-05-02 20:28:44596 // The tab that opened this tab, if any. Will be set to null if the opener
597 // is closed.
598 WebContentsImpl* opener_;
599
[email protected]86ef6a392012-05-11 22:03:11600 // User agent to use if a NavigationEntry requires that the default user agent
601 // is overridden.
602 std::string user_agent_override_;
603
[email protected]0dd3a0ab2011-02-18 08:17:44604 // Helper classes ------------------------------------------------------------
605
606 // Manages creation and swapping of render views.
607 RenderViewHostManager render_manager_;
608
[email protected]483623eb2011-10-25 09:30:00609 // Manages injecting Java objects into all RenderViewHosts associated with
[email protected]b172aee2012-04-10 17:05:26610 // this WebContentsImpl.
[email protected]483623eb2011-10-25 09:30:00611 scoped_ptr<JavaBridgeDispatcherHostManager>
612 java_bridge_dispatcher_host_manager_;
613
[email protected]c7dd2f62011-07-18 15:57:59614 // SavePackage, lazily created.
615 scoped_refptr<SavePackage> save_package_;
616
[email protected]0dd3a0ab2011-02-18 08:17:44617 // Data for loading state ----------------------------------------------------
618
619 // Indicates whether we're currently loading a resource.
620 bool is_loading_;
621
622 // Indicates if the tab is considered crashed.
623 base::TerminationStatus crashed_status_;
624 int crashed_error_code_;
625
[email protected]ca13a442012-04-17 14:00:12626 // Whether this WebContents is waiting for a first-response for the
[email protected]be1f56ab2011-12-22 06:55:31627 // main resource of the page. This controls whether the throbber state is
628 // "waiting" or "loading."
[email protected]0dd3a0ab2011-02-18 08:17:44629 bool waiting_for_response_;
630
[email protected]74ce1ad2011-12-16 21:51:46631 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific
632 // to a given tab and SiteInstance, and must be valid for the lifetime of the
[email protected]b172aee2012-04-10 17:05:26633 // WebContentsImpl.
[email protected]74ce1ad2011-12-16 21:51:46634 std::map<int32, int32> max_page_ids_;
[email protected]0dd3a0ab2011-02-18 08:17:44635
636 // System time at which the current load was started.
637 base::TimeTicks current_load_start_;
638
639 // The current load state and the URL associated with it.
[email protected]9c235f042011-08-10 22:28:21640 net::LoadStateWithParam load_state_;
[email protected]0dd3a0ab2011-02-18 08:17:44641 string16 load_state_host_;
642 // Upload progress, for displaying in the status bar.
643 // Set to zero when there is no significant upload happening.
644 uint64 upload_size_;
645 uint64 upload_position_;
646
647 // Data for current page -----------------------------------------------------
648
[email protected]987fc3a2011-05-26 14:18:09649 // When a title cannot be taken from any entry, this title will be used.
650 string16 page_title_when_no_navigation_entry_;
651
[email protected]0dd3a0ab2011-02-18 08:17:44652 // When a navigation occurs, we record its contents MIME type. It can be
653 // used to check whether we can do something for some special contents.
654 std::string contents_mime_type_;
655
656 // Character encoding.
657 std::string encoding_;
658
[email protected]0dd3a0ab2011-02-18 08:17:44659 // True if this is a secure page which displayed insecure content.
660 bool displayed_insecure_content_;
661
[email protected]0dd3a0ab2011-02-18 08:17:44662 // Data for misc internal state ----------------------------------------------
663
[email protected]ca13a442012-04-17 14:00:12664 // Whether the WebContents is currently being screenshotted.
[email protected]0dd3a0ab2011-02-18 08:17:44665 bool capturing_contents_;
666
667 // See getter above.
668 bool is_being_destroyed_;
669
670 // Indicates whether we should notify about disconnection of this
[email protected]b172aee2012-04-10 17:05:26671 // WebContentsImpl. This is used to ensure disconnection notifications only
[email protected]0dd3a0ab2011-02-18 08:17:44672 // happen if a connection notification has happened and that they happen only
673 // once.
674 bool notify_disconnection_;
675
[email protected]2e5b90c2011-08-16 21:11:55676 // Pointer to the JavaScript dialog creator, lazily assigned. Used because the
[email protected]b172aee2012-04-10 17:05:26677 // delegate of this WebContentsImpl is nulled before its destructor is called.
[email protected]2e5b90c2011-08-16 21:11:55678 content::JavaScriptDialogCreator* dialog_creator_;
679
[email protected]0dd3a0ab2011-02-18 08:17:44680#if defined(OS_WIN)
681 // Handle to an event that's set when the page is showing a message box (or
682 // equivalent constrained window). Plugin processes check this to know if
683 // they should pump messages then.
684 base::win::ScopedHandle message_box_active_;
685#endif
686
[email protected]0dd3a0ab2011-02-18 08:17:44687 // Set to true when there is an active "before unload" dialog. When true,
688 // we've forced the throbber to start in Navigate, and we need to remember to
689 // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled.
690 bool is_showing_before_unload_dialog_;
691
[email protected]0dd3a0ab2011-02-18 08:17:44692 // Settings that get passed to the renderer process.
[email protected]daf82f82011-10-31 22:35:31693 content::RendererPreferences renderer_preferences_;
[email protected]0dd3a0ab2011-02-18 08:17:44694
695 // If this tab was created from a renderer using window.open, this will be
696 // non-NULL and represent the WebUI of the opening renderer.
[email protected]01ec4ec2012-01-18 04:13:47697 content::WebUI::TypeID opener_web_ui_type_;
[email protected]0dd3a0ab2011-02-18 08:17:44698
699 // The time that we started to create the new tab page.
700 base::TimeTicks new_tab_start_time_;
701
[email protected]3bbacc5b2012-04-17 17:46:15702 // The time that we started to close this WebContents.
703 base::TimeTicks close_start_time_;
[email protected]0dd3a0ab2011-02-18 08:17:44704
705 // The time that this tab was last selected.
706 base::TimeTicks last_selected_time_;
707
[email protected]0dd3a0ab2011-02-18 08:17:44708 // See description above setter.
709 bool closed_by_user_gesture_;
710
711 // Minimum/maximum zoom percent.
712 int minimum_zoom_percent_;
713 int maximum_zoom_percent_;
714 // If true, the default zoom limits have been overriden for this tab, in which
715 // case we don't want saved settings to apply to it and we don't want to
716 // remember it.
717 bool temporary_zoom_settings_;
718
[email protected]bcd2815602012-01-14 18:17:23719 // The intrinsic size of the page.
720 gfx::Size preferred_size_;
721
[email protected]0dd3a0ab2011-02-18 08:17:44722 // Content restrictions, used to disable print/copy etc based on content's
723 // (full-page plugins for now only) permissions.
724 int content_restrictions_;
725
[email protected]c8160f22012-05-14 06:44:03726 // Type of view this WebContents is displaying.
[email protected]32ded2212011-11-10 18:51:43727 content::ViewType view_type_;
728
[email protected]da8543762012-03-20 08:52:20729 // Color chooser that was opened by this tab.
730 content::ColorChooser* color_chooser_;
731
[email protected]b172aee2012-04-10 17:05:26732 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
[email protected]0dd3a0ab2011-02-18 08:17:44733};
734
[email protected]93ddb3c2012-04-11 21:44:29735#endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_