[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| 6 | #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| 7 | #pragma once |
| 8 | |
| 9 | #include <deque> |
| 10 | #include <map> |
| 11 | #include <string> |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 12 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 13 | #include "base/gtest_prod_util.h" |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 14 | #include "base/memory/scoped_ptr.h" |
[email protected] | 6eac57a | 2011-07-12 21:15:09 | [diff] [blame] | 15 | #include "base/observer_list.h" |
[email protected] | 45644f6 | 2011-11-23 00:58:23 | [diff] [blame] | 16 | #include "base/property_bag.h" |
[email protected] | 3ab9cb8 | 2011-06-03 18:02:07 | [diff] [blame] | 17 | #include "content/browser/javascript_dialogs.h" |
[email protected] | 0716190 | 2011-11-11 09:57:42 | [diff] [blame] | 18 | #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager.h" |
[email protected] | 5de63471 | 2011-03-02 00:20:19 | [diff] [blame] | 19 | #include "content/browser/renderer_host/render_view_host_delegate.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 20 | #include "content/browser/tab_contents/navigation_controller.h" |
| 21 | #include "content/browser/tab_contents/navigation_entry.h" |
| 22 | #include "content/browser/tab_contents/page_navigator.h" |
| 23 | #include "content/browser/tab_contents/render_view_host_manager.h" |
[email protected] | 8d128d6 | 2011-09-13 22:11:57 | [diff] [blame] | 24 | #include "content/common/content_export.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] | 7043596 | 2011-08-02 20:13:28 | [diff] [blame] | 28 | #include "webkit/glue/resource_type.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 29 | |
| 30 | #if defined(OS_WIN) |
| 31 | #include "base/win/scoped_handle.h" |
| 32 | #endif |
| 33 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 34 | class LoadNotificationDetails; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 35 | class RenderViewHost; |
| 36 | class SessionStorageNamespace; |
| 37 | class SiteInstance; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 38 | class TabContentsView; |
[email protected] | d7b175e | 2011-10-11 15:31:58 | [diff] [blame] | 39 | struct ViewHostMsg_DidFailProvisionalLoadWithError_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 { |
| 42 | class DownloadItem; |
[email protected] | d8c66043 | 2011-12-22 20:51:25 | [diff] [blame^] | 43 | class WebContentsObserver; |
[email protected] | 674bc59 | 2011-12-20 23:00:42 | [diff] [blame] | 44 | class WebContentsDelegate; |
[email protected] | e582fdd | 2011-12-20 16:48:17 | [diff] [blame] | 45 | } |
| 46 | |
[email protected] | daf82f8 | 2011-10-31 22:35:31 | [diff] [blame] | 47 | namespace webkit_glue { |
| 48 | struct WebIntentData; |
| 49 | } |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 50 | |
[email protected] | 58f5d56 | 2011-12-20 17:13:03 | [diff] [blame] | 51 | class CONTENT_EXPORT TabContents : public content::WebContents, |
[email protected] | 6934a70 | 2011-12-20 00:04:51 | [diff] [blame] | 52 | public PageNavigator, |
[email protected] | 8d128d6 | 2011-09-13 22:11:57 | [diff] [blame] | 53 | public RenderViewHostDelegate, |
| 54 | public RenderViewHostManager::Delegate, |
| 55 | public content::JavaScriptDialogDelegate { |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 56 | public: |
[email protected] | 674bc59 | 2011-12-20 23:00:42 | [diff] [blame] | 57 | // Flags passed to the WebContentsDelegate.NavigationStateChanged to tell it |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 58 | // what has changed. Combine them to update more than one thing. |
| 59 | enum InvalidateTypes { |
| 60 | INVALIDATE_URL = 1 << 0, // The URL has changed. |
| 61 | INVALIDATE_TAB = 1 << 1, // The favicon, app icon, or crashed |
| 62 | // state changed. |
| 63 | INVALIDATE_LOAD = 1 << 2, // The loading state has changed. |
| 64 | INVALIDATE_PAGE_ACTIONS = 1 << 3, // Page action icons have changed. |
[email protected] | 93f230e0 | 2011-06-01 14:40:00 | [diff] [blame] | 65 | INVALIDATE_TITLE = 1 << 4, // The title changed. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | // |base_tab_contents| is used if we want to size the new tab contents view |
| 69 | // based on an existing tab contents view. This can be NULL if not needed. |
| 70 | // |
| 71 | // The session storage namespace parameter allows multiple render views and |
| 72 | // tab contentses to share the same session storage (part of the WebStorage |
| 73 | // spec) space. This is useful when restoring tabs, but most callers should |
| 74 | // pass in NULL which will cause a new SessionStorageNamespace to be created. |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 75 | TabContents(content::BrowserContext* browser_context, |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 76 | SiteInstance* site_instance, |
| 77 | int routing_id, |
| 78 | const TabContents* base_tab_contents, |
| 79 | SessionStorageNamespace* session_storage_namespace); |
| 80 | virtual ~TabContents(); |
| 81 | |
[email protected] | c7dd2f6 | 2011-07-18 15:57:59 | [diff] [blame] | 82 | // Returns the SavePackage which manages the page saving job. May be NULL. |
| 83 | SavePackage* save_package() const { return save_package_.get(); } |
| 84 | |
[email protected] | 74ce1ad | 2011-12-16 21:51:46 | [diff] [blame] | 85 | // Updates the max page ID for the current SiteInstance in this TabContents |
| 86 | // to be at least |page_id|. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 87 | void UpdateMaxPageID(int32 page_id); |
| 88 | |
[email protected] | 74ce1ad | 2011-12-16 21:51:46 | [diff] [blame] | 89 | // Updates the max page ID for the given SiteInstance in this TabContents |
| 90 | // to be at least |page_id|. |
| 91 | void UpdateMaxPageIDForSiteInstance(SiteInstance* site_instance, |
| 92 | int32 page_id); |
| 93 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 94 | // Called by the NavigationController to cause the TabContents to navigate to |
| 95 | // the current pending entry. The NavigationController should be called back |
[email protected] | 9a7e68c | 2011-05-26 17:35:50 | [diff] [blame] | 96 | // with RendererDidNavigate on success or DiscardPendingEntry on failure. |
| 97 | // The callbacks can be inside of this function, or at some future time. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 98 | // |
| 99 | // The entry has a PageID of -1 if newly created (corresponding to navigation |
| 100 | // to a new URL). |
| 101 | // |
| 102 | // If this method returns false, then the navigation is discarded (equivalent |
| 103 | // to calling DiscardPendingEntry on the NavigationController). |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 104 | bool NavigateToPendingEntry( |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 105 | NavigationController::ReloadType reload_type); |
| 106 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 107 | // Sets the passed passed interstitial as the currently showing interstitial. |
| 108 | // |interstitial_page| should be non NULL (use the remove_interstitial_page |
| 109 | // method to unset the interstitial) and no interstitial page should be set |
| 110 | // when there is already a non NULL interstitial page set. |
| 111 | void set_interstitial_page(InterstitialPage* interstitial_page) { |
| 112 | render_manager_.set_interstitial_page(interstitial_page); |
| 113 | } |
| 114 | |
| 115 | // Unsets the currently showing interstitial. |
| 116 | void remove_interstitial_page() { |
| 117 | render_manager_.remove_interstitial_page(); |
| 118 | } |
| 119 | |
[email protected] | 1fd1a50 | 2011-03-30 16:55:56 | [diff] [blame] | 120 | void set_opener_web_ui_type(WebUI::TypeID opener_web_ui_type) { |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 121 | opener_web_ui_type_ = opener_web_ui_type; |
| 122 | } |
| 123 | |
[email protected] | 276b37a2 | 2011-11-08 20:45:46 | [diff] [blame] | 124 | JavaBridgeDispatcherHostManager* java_bridge_dispatcher_host_manager() const { |
| 125 | return java_bridge_dispatcher_host_manager_.get(); |
| 126 | } |
| 127 | |
[email protected] | 58f5d56 | 2011-12-20 17:13:03 | [diff] [blame] | 128 | // content::WebContents ------------------------------------------------------ |
[email protected] | 6934a70 | 2011-12-20 00:04:51 | [diff] [blame] | 129 | virtual const base::PropertyBag* GetPropertyBag() const OVERRIDE; |
| 130 | virtual base::PropertyBag* GetPropertyBag() OVERRIDE; |
[email protected] | 674bc59 | 2011-12-20 23:00:42 | [diff] [blame] | 131 | virtual content::WebContentsDelegate* GetDelegate() OVERRIDE; |
| 132 | virtual void SetDelegate(content::WebContentsDelegate* delegate) OVERRIDE; |
[email protected] | f5fa20e | 2011-12-21 22:35:56 | [diff] [blame] | 133 | virtual NavigationController& GetController() OVERRIDE; |
| 134 | virtual const NavigationController& GetController() const OVERRIDE; |
[email protected] | 627e051 | 2011-12-21 22:55:30 | [diff] [blame] | 135 | virtual content::BrowserContext* GetBrowserContext() const OVERRIDE; |
[email protected] | f5fa20e | 2011-12-21 22:35:56 | [diff] [blame] | 136 | virtual void SetViewType(content::ViewType type) OVERRIDE; |
| 137 | virtual content::RenderProcessHost* GetRenderProcessHost() const OVERRIDE; |
[email protected] | 151a63d | 2011-12-20 22:32:52 | [diff] [blame] | 138 | virtual RenderViewHost* GetRenderViewHost() const OVERRIDE; |
[email protected] | d487beefe | 2011-12-21 05:41:21 | [diff] [blame] | 139 | virtual RenderWidgetHostView* GetRenderWidgetHostView() const OVERRIDE; |
| 140 | virtual TabContentsView* GetView() const OVERRIDE; |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 141 | virtual WebUI* GetWebUI() const OVERRIDE; |
| 142 | virtual WebUI* GetCommittedWebUI() const OVERRIDE; |
| 143 | virtual const string16& GetTitle() const OVERRIDE; |
| 144 | virtual int32 GetMaxPageID() OVERRIDE; |
| 145 | virtual int32 GetMaxPageIDForSiteInstance( |
| 146 | SiteInstance* site_instance) OVERRIDE; |
| 147 | virtual SiteInstance* GetSiteInstance() const OVERRIDE; |
| 148 | virtual SiteInstance* GetPendingSiteInstance() const OVERRIDE; |
| 149 | virtual bool IsLoading() const OVERRIDE; |
| 150 | virtual bool IsWaitingForResponse() const OVERRIDE; |
| 151 | virtual const net::LoadStateWithParam& GetLoadState() const OVERRIDE; |
| 152 | virtual const string16& GetLoadStateHost() const OVERRIDE; |
| 153 | virtual uint64 GetUploadSize() const OVERRIDE; |
| 154 | virtual uint64 GetUploadPosition() const OVERRIDE; |
| 155 | virtual const std::string& GetEncoding() const OVERRIDE; |
| 156 | virtual bool DisplayedInsecureContent() const OVERRIDE; |
| 157 | virtual void SetCapturingContents(bool cap) OVERRIDE; |
| 158 | virtual bool IsCrashed() const OVERRIDE; |
| 159 | virtual void SetIsCrashed(base::TerminationStatus status, |
| 160 | int error_code) OVERRIDE; |
| 161 | virtual base::TerminationStatus GetCrashedStatus() const OVERRIDE; |
| 162 | virtual bool IsBeingDestroyed() const OVERRIDE; |
| 163 | virtual void NotifyNavigationStateChanged(unsigned changed_flags) OVERRIDE; |
| 164 | virtual void DidBecomeSelected() OVERRIDE; |
| 165 | virtual base::TimeTicks GetLastSelectedTime() const OVERRIDE; |
| 166 | virtual void WasHidden() OVERRIDE; |
| 167 | virtual void ShowContents() OVERRIDE; |
| 168 | virtual void HideContents() OVERRIDE; |
| 169 | virtual bool NeedToFireBeforeUnload() OVERRIDE; |
| 170 | virtual RenderViewHostManager* GetRenderManagerForTesting() OVERRIDE; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 171 | virtual void Stop() OVERRIDE; |
| 172 | virtual TabContents* Clone() OVERRIDE; |
| 173 | virtual void ShowPageInfo(const GURL& url, |
| 174 | const NavigationEntry::SSLStatus& ssl, |
| 175 | bool show_history) OVERRIDE; |
| 176 | virtual void AddNewContents(TabContents* new_contents, |
| 177 | WindowOpenDisposition disposition, |
| 178 | const gfx::Rect& initial_pos, |
| 179 | bool user_gesture) OVERRIDE; |
| 180 | virtual gfx::NativeView GetContentNativeView() const OVERRIDE; |
| 181 | virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 182 | virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE; |
| 183 | virtual void Focus() OVERRIDE; |
| 184 | virtual void FocusThroughTabTraversal(bool reverse) OVERRIDE; |
| 185 | virtual bool ShowingInterstitialPage() const OVERRIDE; |
| 186 | virtual InterstitialPage* GetInterstitialPage() const OVERRIDE; |
| 187 | virtual void OnSavePage() OVERRIDE; |
| 188 | virtual bool SavePage(const FilePath& main_file, |
| 189 | const FilePath& dir_path, |
| 190 | SavePackage::SavePackageType save_type) OVERRIDE; |
| 191 | virtual bool IsActiveEntry(int32 page_id) OVERRIDE; |
| 192 | |
| 193 | virtual const std::string& GetContentsMimeType() const OVERRIDE; |
| 194 | virtual bool WillNotifyDisconnection() const OVERRIDE; |
| 195 | virtual void SetOverrideEncoding(const std::string& encoding) OVERRIDE; |
| 196 | virtual void ResetOverrideEncoding() OVERRIDE; |
| 197 | virtual content::RendererPreferences* GetMutableRendererPrefs() OVERRIDE; |
| 198 | virtual void SetNewTabStartTime(const base::TimeTicks& time) OVERRIDE; |
| 199 | virtual base::TimeTicks GetNewTabStartTime() const OVERRIDE; |
| 200 | virtual void OnCloseStarted() OVERRIDE; |
| 201 | virtual bool ShouldAcceptDragAndDrop() const OVERRIDE; |
| 202 | virtual void SystemDragEnded() OVERRIDE; |
| 203 | virtual void SetClosedByUserGesture(bool value) OVERRIDE; |
| 204 | virtual bool GetClosedByUserGesture() const OVERRIDE; |
| 205 | virtual double GetZoomLevel() const OVERRIDE; |
| 206 | virtual int GetZoomPercent(bool* enable_increment, |
| 207 | bool* enable_decrement) OVERRIDE; |
| 208 | virtual void ViewSource() OVERRIDE; |
| 209 | virtual void ViewFrameSource(const GURL& url, |
| 210 | const std::string& content_state) OVERRIDE; |
| 211 | virtual int GetMinimumZoomPercent() const OVERRIDE; |
| 212 | virtual int GetMaximumZoomPercent() const OVERRIDE; |
| 213 | virtual int GetContentRestrictions() const OVERRIDE; |
| 214 | virtual WebUI::TypeID GetWebUITypeForCurrentState() OVERRIDE; |
| 215 | virtual WebUI* GetWebUIForCurrentState() OVERRIDE; |
| 216 | virtual bool GotResponseToLockMouseRequest(bool allowed) OVERRIDE; |
| 217 | |
| 218 | // Implementation of PageNavigator. |
| 219 | |
| 220 | // Deprecated. Please use the one-argument variant instead. |
| 221 | // TODO(adriansc): Remove this method once refactoring changed all call sites. |
| 222 | virtual TabContents* OpenURL(const GURL& url, |
| 223 | const GURL& referrer, |
| 224 | WindowOpenDisposition disposition, |
| 225 | content::PageTransition transition) OVERRIDE; |
| 226 | |
| 227 | virtual TabContents* OpenURL(const OpenURLParams& params) OVERRIDE; |
[email protected] | 151a63d | 2011-12-20 22:32:52 | [diff] [blame] | 228 | |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 229 | // RenderViewHostDelegate ---------------------------------------------------- |
| 230 | |
| 231 | virtual RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE; |
| 232 | virtual RenderViewHostDelegate::RendererManagement* |
| 233 | GetRendererManagementDelegate() OVERRIDE; |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 234 | virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 235 | virtual const GURL& GetURL() const OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 236 | virtual TabContents* GetAsTabContents() OVERRIDE; |
| 237 | virtual content::ViewType GetRenderViewType() const OVERRIDE; |
| 238 | virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; |
| 239 | virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE; |
| 240 | virtual void RenderViewGone(RenderViewHost* render_view_host, |
| 241 | base::TerminationStatus status, |
| 242 | int error_code) OVERRIDE; |
| 243 | virtual void RenderViewDeleted(RenderViewHost* render_view_host) OVERRIDE; |
| 244 | virtual void DidNavigate( |
| 245 | RenderViewHost* render_view_host, |
| 246 | const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; |
| 247 | virtual void UpdateState(RenderViewHost* render_view_host, |
| 248 | int32 page_id, |
| 249 | const std::string& state) OVERRIDE; |
| 250 | virtual void UpdateTitle(RenderViewHost* render_view_host, |
| 251 | int32 page_id, |
| 252 | const string16& title, |
| 253 | base::i18n::TextDirection title_direction) OVERRIDE; |
| 254 | virtual void UpdateEncoding(RenderViewHost* render_view_host, |
| 255 | const std::string& encoding) OVERRIDE; |
| 256 | virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE; |
| 257 | virtual void Close(RenderViewHost* render_view_host) OVERRIDE; |
| 258 | virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE; |
| 259 | virtual void SwappedOut(RenderViewHost* render_view_host) OVERRIDE; |
| 260 | virtual void DidStartLoading() OVERRIDE; |
| 261 | virtual void DidStopLoading() OVERRIDE; |
| 262 | virtual void DidCancelLoading() OVERRIDE; |
| 263 | virtual void DidChangeLoadProgress(double progress) OVERRIDE; |
| 264 | virtual void DocumentAvailableInMainFrame( |
| 265 | RenderViewHost* render_view_host) OVERRIDE; |
| 266 | virtual void DocumentOnLoadCompletedInMainFrame( |
| 267 | RenderViewHost* render_view_host, |
| 268 | int32 page_id) OVERRIDE; |
| 269 | virtual void RequestOpenURL(const GURL& url, |
[email protected] | 445e104 | 2011-12-03 21:03:15 | [diff] [blame] | 270 | const content::Referrer& referrer, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 271 | WindowOpenDisposition disposition, |
| 272 | int64 source_frame_id) OVERRIDE; |
[email protected] | 4ad5d77d | 2011-12-03 02:00:48 | [diff] [blame] | 273 | virtual void RequestTransferURL( |
| 274 | const GURL& url, |
[email protected] | bce1f1c | 2011-12-05 15:11:58 | [diff] [blame] | 275 | const content::Referrer& referrer, |
[email protected] | 4ad5d77d | 2011-12-03 02:00:48 | [diff] [blame] | 276 | WindowOpenDisposition disposition, |
| 277 | int64 source_frame_id, |
| 278 | const GlobalRequestID& transferred_global_request_id) OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 279 | virtual void RunJavaScriptMessage(const RenderViewHost* rvh, |
| 280 | const string16& message, |
| 281 | const string16& default_prompt, |
| 282 | const GURL& frame_url, |
[email protected] | 269f86d | 2011-12-07 02:43:47 | [diff] [blame] | 283 | ui::JavascriptMessageType type, |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 284 | IPC::Message* reply_msg, |
| 285 | bool* did_suppress_message) OVERRIDE; |
| 286 | virtual void RunBeforeUnloadConfirm(const RenderViewHost* rvh, |
| 287 | const string16& message, |
| 288 | IPC::Message* reply_msg) OVERRIDE; |
| 289 | virtual content::RendererPreferences GetRendererPrefs( |
| 290 | content::BrowserContext* browser_context) const OVERRIDE; |
| 291 | virtual WebPreferences GetWebkitPrefs() OVERRIDE; |
| 292 | virtual void OnUserGesture() OVERRIDE; |
| 293 | virtual void OnIgnoredUIEvent() OVERRIDE; |
| 294 | virtual void RendererUnresponsive(RenderViewHost* render_view_host, |
| 295 | bool is_during_unload) OVERRIDE; |
| 296 | virtual void RendererResponsive(RenderViewHost* render_view_host) OVERRIDE; |
| 297 | virtual void LoadStateChanged(const GURL& url, |
| 298 | const net::LoadStateWithParam& load_state, |
| 299 | uint64 upload_position, |
| 300 | uint64 upload_size) OVERRIDE; |
| 301 | virtual void WorkerCrashed() OVERRIDE; |
| 302 | virtual void Activate() OVERRIDE; |
| 303 | virtual void Deactivate() OVERRIDE; |
| 304 | virtual void LostCapture() OVERRIDE; |
| 305 | virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
| 306 | bool* is_keyboard_shortcut) OVERRIDE; |
| 307 | virtual void HandleKeyboardEvent( |
| 308 | const NativeWebKeyboardEvent& event) OVERRIDE; |
| 309 | virtual void HandleMouseDown() OVERRIDE; |
| 310 | virtual void HandleMouseUp() OVERRIDE; |
| 311 | virtual void HandleMouseActivate() OVERRIDE; |
[email protected] | edc64de | 2011-11-17 20:07:38 | [diff] [blame] | 312 | virtual void RunFileChooser( |
| 313 | RenderViewHost* render_view_host, |
[email protected] | 8caadeb | 2011-11-22 02:45:23 | [diff] [blame] | 314 | const content::FileChooserParams& params) OVERRIDE; |
[email protected] | 952a68e | 2011-11-17 00:36:10 | [diff] [blame] | 315 | virtual void ToggleFullscreenMode(bool enter_fullscreen) OVERRIDE; |
| 316 | virtual bool IsFullscreenForCurrentTab() const OVERRIDE; |
| 317 | virtual void UpdatePreferredSize(const gfx::Size& pref_size) OVERRIDE; |
| 318 | virtual void WebUISend(RenderViewHost* render_view_host, |
| 319 | const GURL& source_url, |
| 320 | const std::string& name, |
| 321 | const base::ListValue& args) OVERRIDE; |
| 322 | virtual void RequestToLockMouse() OVERRIDE; |
| 323 | virtual void LostMouseLock() OVERRIDE; |
| 324 | |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 325 | // RenderViewHostManager::Delegate ------------------------------------------- |
| 326 | |
| 327 | virtual bool CreateRenderViewForRenderManager( |
| 328 | RenderViewHost* render_view_host) OVERRIDE; |
| 329 | virtual void BeforeUnloadFiredFromRenderManager( |
| 330 | bool proceed, |
| 331 | bool* proceed_to_fire_unload) OVERRIDE; |
| 332 | virtual void DidStartLoadingFromRenderManager( |
| 333 | RenderViewHost* render_view_host) OVERRIDE; |
| 334 | virtual void RenderViewGoneFromRenderManager( |
| 335 | RenderViewHost* render_view_host) OVERRIDE; |
| 336 | virtual void UpdateRenderViewSizeForRenderManager() OVERRIDE; |
| 337 | virtual void NotifySwappedFromRenderManager() OVERRIDE; |
| 338 | virtual NavigationController& GetControllerForRenderManager() OVERRIDE; |
| 339 | virtual WebUI* CreateWebUIForRenderManager(const GURL& url) OVERRIDE; |
| 340 | virtual NavigationEntry* |
| 341 | GetLastCommittedNavigationEntryForRenderManager() OVERRIDE; |
| 342 | virtual bool FocusLocationBarByDefault() OVERRIDE; |
| 343 | virtual void SetFocusToLocationBar(bool select_all) OVERRIDE; |
| 344 | virtual void CreateViewAndSetSizeForRVH(RenderViewHost* rvh) OVERRIDE; |
| 345 | |
| 346 | // Overridden from JavaScriptDialogDelegate: |
| 347 | virtual void OnDialogClosed(IPC::Message* reply_msg, |
| 348 | bool success, |
| 349 | const string16& user_input) OVERRIDE; |
| 350 | virtual gfx::NativeWindow GetDialogRootWindow() const OVERRIDE; |
| 351 | virtual void OnDialogShown() OVERRIDE; |
| 352 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 353 | protected: |
[email protected] | d8c66043 | 2011-12-22 20:51:25 | [diff] [blame^] | 354 | friend class content::WebContentsObserver; |
[email protected] | 553602e1 | 2011-04-05 17:01:18 | [diff] [blame] | 355 | |
| 356 | // Add and remove observers for page navigation notifications. Adding or |
| 357 | // removing multiple times has no effect. The order in which notifications |
| 358 | // are sent to observers is undefined. Clients must be sure to remove the |
| 359 | // observer before they go away. |
[email protected] | d8c66043 | 2011-12-22 20:51:25 | [diff] [blame^] | 360 | void AddObserver(content::WebContentsObserver* observer); |
| 361 | void RemoveObserver(content::WebContentsObserver* observer); |
[email protected] | 553602e1 | 2011-04-05 17:01:18 | [diff] [blame] | 362 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 363 | private: |
| 364 | friend class NavigationController; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 365 | |
| 366 | FRIEND_TEST_ALL_PREFIXES(TabContentsTest, NoJSMessageOnInterstitials); |
| 367 | FRIEND_TEST_ALL_PREFIXES(TabContentsTest, UpdateTitle); |
| 368 | FRIEND_TEST_ALL_PREFIXES(TabContentsTest, CrossSiteCantPreemptAfterUnload); |
| 369 | FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); |
| 370 | FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); |
| 371 | FRIEND_TEST_ALL_PREFIXES(RenderViewHostManagerTest, PageDoesBackAndReload); |
| 372 | |
| 373 | // Temporary until the view/contents separation is complete. |
| 374 | friend class TabContentsView; |
[email protected] | 9a56a0d | 2011-05-13 19:03:31 | [diff] [blame] | 375 | #if defined(TOOLKIT_VIEWS) |
[email protected] | 7e2cef5 | 2011-04-11 21:47:23 | [diff] [blame] | 376 | friend class TabContentsViewViews; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 377 | #elif defined(OS_MACOSX) |
| 378 | friend class TabContentsViewMac; |
| 379 | #elif defined(TOOLKIT_USES_GTK) |
| 380 | friend class TabContentsViewGtk; |
| 381 | #endif |
| 382 | |
| 383 | // So InterstitialPage can access SetIsLoading. |
| 384 | friend class InterstitialPage; |
| 385 | |
| 386 | // TODO(brettw) TestTabContents shouldn't exist! |
| 387 | friend class TestTabContents; |
| 388 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 389 | // Message handlers. |
[email protected] | 8b5af49 | 2011-11-28 21:50:58 | [diff] [blame] | 390 | void OnRegisterIntentService(const string16& action, |
[email protected] | 63c23932 | 2011-10-31 23:56:30 | [diff] [blame] | 391 | const string16& type, |
| 392 | const string16& href, |
| 393 | const string16& title, |
| 394 | const string16& disposition); |
[email protected] | 67810501 | 2011-12-09 04:01:21 | [diff] [blame] | 395 | void OnWebIntentDispatch(const webkit_glue::WebIntentData& intent, |
[email protected] | 63c23932 | 2011-10-31 23:56:30 | [diff] [blame] | 396 | int intent_id); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 397 | void OnDidStartProvisionalLoadForFrame(int64 frame_id, |
| 398 | bool main_frame, |
[email protected] | 57b9396c | 2011-10-07 19:11:59 | [diff] [blame] | 399 | const GURL& opener_url, |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 400 | const GURL& url); |
| 401 | void OnDidRedirectProvisionalLoad(int32 page_id, |
[email protected] | 57b9396c | 2011-10-07 19:11:59 | [diff] [blame] | 402 | const GURL& opener_url, |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 403 | const GURL& source_url, |
| 404 | const GURL& target_url); |
[email protected] | d7b175e | 2011-10-11 15:31:58 | [diff] [blame] | 405 | void OnDidFailProvisionalLoadWithError( |
| 406 | const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 407 | void OnDidLoadResourceFromMemoryCache(const GURL& url, |
[email protected] | 7043596 | 2011-08-02 20:13:28 | [diff] [blame] | 408 | const std::string& security_info, |
| 409 | const std::string& http_request, |
| 410 | ResourceType::Type resource_type); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 411 | void OnDidDisplayInsecureContent(); |
| 412 | void OnDidRunInsecureContent(const std::string& security_origin, |
| 413 | const GURL& target_url); |
| 414 | void OnDocumentLoadedInFrame(int64 frame_id); |
[email protected] | 1a55c5be | 2011-11-29 11:36:31 | [diff] [blame] | 415 | void OnDidFinishLoad(int64 frame_id, |
| 416 | const GURL& validated_url, |
| 417 | bool is_main_frame); |
| 418 | void OnDidFailLoadWithError(int64 frame_id, |
| 419 | const GURL& validated_url, |
| 420 | bool is_main_frame, |
| 421 | int error_code, |
| 422 | const string16& error_description); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 423 | void OnUpdateContentRestrictions(int restrictions); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 424 | void OnGoToEntryAtOffset(int offset); |
[email protected] | 21681395 | 2011-05-19 22:21:26 | [diff] [blame] | 425 | void OnUpdateZoomLimits(int minimum_percent, |
| 426 | int maximum_percent, |
| 427 | bool remember); |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 428 | void OnSaveURL(const GURL& url); |
[email protected] | 3a29a6e | 2011-08-24 18:26:21 | [diff] [blame] | 429 | void OnEnumerateDirectory(int request_id, const FilePath& path); |
[email protected] | 7d18902 | 2011-08-25 22:54:20 | [diff] [blame] | 430 | void OnJSOutOfMemory(); |
| 431 | void OnRegisterProtocolHandler(const std::string& protocol, |
| 432 | const GURL& url, |
| 433 | const string16& title); |
[email protected] | b888919c | 2011-09-02 00:32:16 | [diff] [blame] | 434 | void OnFindReply(int request_id, int number_of_matches, |
| 435 | const gfx::Rect& selection_rect, int active_match_ordinal, |
| 436 | bool final_update); |
[email protected] | d952a05 | 2011-09-06 18:42:45 | [diff] [blame] | 437 | void OnCrashedPlugin(const FilePath& plugin_path); |
[email protected] | 7fc4bbb | 2011-09-08 21:23:10 | [diff] [blame] | 438 | void OnAppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 439 | |
| 440 | // Changes the IsLoading state and notifies delegate as needed |
| 441 | // |details| is used to provide details on the load that just finished |
| 442 | // (but can be null if not applicable). Can be overridden. |
| 443 | void SetIsLoading(bool is_loading, |
| 444 | LoadNotificationDetails* details); |
| 445 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 446 | // Called by derived classes to indicate that we're no longer waiting for a |
| 447 | // response. This won't actually update the throbber, but it will get picked |
| 448 | // up at the next animation step if the throbber is going. |
| 449 | void SetNotWaitingForResponse() { waiting_for_response_ = false; } |
| 450 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 451 | // Navigation helpers -------------------------------------------------------- |
| 452 | // |
| 453 | // These functions are helpers for Navigate() and DidNavigate(). |
| 454 | |
| 455 | // Handles post-navigation tasks in DidNavigate AFTER the entry has been |
| 456 | // committed to the navigation controller. Note that the navigation entry is |
| 457 | // not provided since it may be invalid/changed after being committed. The |
| 458 | // current navigation entry is in the NavigationController at this point. |
| 459 | void DidNavigateMainFramePostCommit( |
[email protected] | 8286f51a | 2011-05-31 17:39:13 | [diff] [blame] | 460 | const content::LoadCommittedDetails& details, |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 461 | const ViewHostMsg_FrameNavigate_Params& params); |
| 462 | void DidNavigateAnyFramePostCommit( |
| 463 | RenderViewHost* render_view_host, |
[email protected] | 8286f51a | 2011-05-31 17:39:13 | [diff] [blame] | 464 | const content::LoadCommittedDetails& details, |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 465 | const ViewHostMsg_FrameNavigate_Params& params); |
| 466 | |
[email protected] | 74ce1ad | 2011-12-16 21:51:46 | [diff] [blame] | 467 | // If our controller was restored, update the max page ID associated with the |
| 468 | // given RenderViewHost to be larger than the number of restored entries. |
| 469 | // This is called in CreateRenderView before any navigations in the RenderView |
| 470 | // have begun, to prevent any races in updating RenderView::next_page_id. |
| 471 | void UpdateMaxPageIDIfNecessary(RenderViewHost* rvh); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 472 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 473 | // Saves the given title to the navigation entry and does associated work. It |
| 474 | // will update history and the view for the new title, and also synthesize |
| 475 | // titles for file URLs that have none (so we require that the URL of the |
| 476 | // entry already be set). |
| 477 | // |
| 478 | // This is used as the backend for state updates, which include a new title, |
| 479 | // or the dedicated set title message. It returns true if the new title is |
| 480 | // different and was therefore updated. |
[email protected] | acafd27 | 2011-07-26 17:35:57 | [diff] [blame] | 481 | bool UpdateTitleForEntry(NavigationEntry* entry, const string16& title); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 482 | |
| 483 | // Causes the TabContents to navigate in the right renderer to |entry|, which |
| 484 | // must be already part of the entries in the navigation controller. |
| 485 | // This does not change the NavigationController state. |
[email protected] | dd11de5 | 2011-11-03 22:54:27 | [diff] [blame] | 486 | bool NavigateToEntry(const NavigationEntry& entry, |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 487 | NavigationController::ReloadType reload_type); |
| 488 | |
[email protected] | 796931a9 | 2011-08-10 01:32:14 | [diff] [blame] | 489 | // Sets the history for this tab_contents to |history_length| entries, and |
| 490 | // moves the current page_id to the last entry in the list if it's valid. |
| 491 | // This is mainly used when a prerendered page is swapped into the current |
[email protected] | 9e1ad4b | 2011-08-14 16:49:19 | [diff] [blame] | 492 | // tab. The method is virtual for testing. |
| 493 | virtual void SetHistoryLengthAndPrune(const SiteInstance* site_instance, |
| 494 | int merge_history_length, |
| 495 | int32 minimum_page_id); |
[email protected] | 796931a9 | 2011-08-10 01:32:14 | [diff] [blame] | 496 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 497 | // Misc non-view stuff ------------------------------------------------------- |
| 498 | |
| 499 | // Helper functions for sending notifications. |
| 500 | void NotifySwapped(); |
| 501 | void NotifyConnected(); |
| 502 | void NotifyDisconnected(); |
| 503 | |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 504 | void SetEncoding(const std::string& encoding); |
| 505 | |
[email protected] | 8189899 | 2011-06-14 22:15:00 | [diff] [blame] | 506 | // Stores random bits of data for others to associate with this object. |
| 507 | // WARNING: this needs to be deleted after NavigationController. |
[email protected] | 45644f6 | 2011-11-23 00:58:23 | [diff] [blame] | 508 | base::PropertyBag property_bag_; |
[email protected] | 8189899 | 2011-06-14 22:15:00 | [diff] [blame] | 509 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 510 | // Data for core operation --------------------------------------------------- |
| 511 | |
| 512 | // Delegate for notifying our owner about stuff. Not owned by us. |
[email protected] | 674bc59 | 2011-12-20 23:00:42 | [diff] [blame] | 513 | content::WebContentsDelegate* delegate_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 514 | |
| 515 | // Handles the back/forward list and loading. |
| 516 | NavigationController controller_; |
| 517 | |
| 518 | // The corresponding view. |
| 519 | scoped_ptr<TabContentsView> view_; |
| 520 | |
[email protected] | 99604297 | 2011-11-08 22:43:59 | [diff] [blame] | 521 | // A list of observers notified when page state changes. Weak references. |
| 522 | // This MUST be listed above render_manager_ since at destruction time the |
| 523 | // latter might cause RenderViewHost's destructor to call us and we might use |
| 524 | // the observer list then. |
[email protected] | d8c66043 | 2011-12-22 20:51:25 | [diff] [blame^] | 525 | ObserverList<content::WebContentsObserver> observers_; |
[email protected] | 99604297 | 2011-11-08 22:43:59 | [diff] [blame] | 526 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 527 | // Helper classes ------------------------------------------------------------ |
| 528 | |
| 529 | // Manages creation and swapping of render views. |
| 530 | RenderViewHostManager render_manager_; |
| 531 | |
[email protected] | 483623eb | 2011-10-25 09:30:00 | [diff] [blame] | 532 | // Manages injecting Java objects into all RenderViewHosts associated with |
| 533 | // this TabContents. |
| 534 | scoped_ptr<JavaBridgeDispatcherHostManager> |
| 535 | java_bridge_dispatcher_host_manager_; |
| 536 | |
[email protected] | c7dd2f6 | 2011-07-18 15:57:59 | [diff] [blame] | 537 | // SavePackage, lazily created. |
| 538 | scoped_refptr<SavePackage> save_package_; |
| 539 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 540 | // Data for loading state ---------------------------------------------------- |
| 541 | |
| 542 | // Indicates whether we're currently loading a resource. |
| 543 | bool is_loading_; |
| 544 | |
| 545 | // Indicates if the tab is considered crashed. |
| 546 | base::TerminationStatus crashed_status_; |
| 547 | int crashed_error_code_; |
| 548 | |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 549 | // Whether this tab contents is waiting for a first-response for the |
| 550 | // main resource of the page. This controls whether the throbber state is |
| 551 | // "waiting" or "loading." |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 552 | bool waiting_for_response_; |
| 553 | |
[email protected] | 74ce1ad | 2011-12-16 21:51:46 | [diff] [blame] | 554 | // Map of SiteInstance ID to max page ID for this tab. A page ID is specific |
| 555 | // to a given tab and SiteInstance, and must be valid for the lifetime of the |
| 556 | // TabContents. |
| 557 | std::map<int32, int32> max_page_ids_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 558 | |
| 559 | // System time at which the current load was started. |
| 560 | base::TimeTicks current_load_start_; |
| 561 | |
| 562 | // The current load state and the URL associated with it. |
[email protected] | 9c235f04 | 2011-08-10 22:28:21 | [diff] [blame] | 563 | net::LoadStateWithParam load_state_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 564 | string16 load_state_host_; |
| 565 | // Upload progress, for displaying in the status bar. |
| 566 | // Set to zero when there is no significant upload happening. |
| 567 | uint64 upload_size_; |
| 568 | uint64 upload_position_; |
| 569 | |
| 570 | // Data for current page ----------------------------------------------------- |
| 571 | |
[email protected] | 987fc3a | 2011-05-26 14:18:09 | [diff] [blame] | 572 | // When a title cannot be taken from any entry, this title will be used. |
| 573 | string16 page_title_when_no_navigation_entry_; |
| 574 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 575 | // When a navigation occurs, we record its contents MIME type. It can be |
| 576 | // used to check whether we can do something for some special contents. |
| 577 | std::string contents_mime_type_; |
| 578 | |
| 579 | // Character encoding. |
| 580 | std::string encoding_; |
| 581 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 582 | // True if this is a secure page which displayed insecure content. |
| 583 | bool displayed_insecure_content_; |
| 584 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 585 | // Data for misc internal state ---------------------------------------------- |
| 586 | |
[email protected] | be1f56ab | 2011-12-22 06:55:31 | [diff] [blame] | 587 | // Whether the tab contents is currently being screenshotted by the |
| 588 | // DraggedTabController. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 589 | bool capturing_contents_; |
| 590 | |
| 591 | // See getter above. |
| 592 | bool is_being_destroyed_; |
| 593 | |
| 594 | // Indicates whether we should notify about disconnection of this |
| 595 | // TabContents. This is used to ensure disconnection notifications only |
| 596 | // happen if a connection notification has happened and that they happen only |
| 597 | // once. |
| 598 | bool notify_disconnection_; |
| 599 | |
[email protected] | 2e5b90c | 2011-08-16 21:11:55 | [diff] [blame] | 600 | // Pointer to the JavaScript dialog creator, lazily assigned. Used because the |
| 601 | // delegate of this TabContents is nulled before its destructor is called. |
| 602 | content::JavaScriptDialogCreator* dialog_creator_; |
| 603 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 604 | #if defined(OS_WIN) |
| 605 | // Handle to an event that's set when the page is showing a message box (or |
| 606 | // equivalent constrained window). Plugin processes check this to know if |
| 607 | // they should pump messages then. |
| 608 | base::win::ScopedHandle message_box_active_; |
| 609 | #endif |
| 610 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 611 | // Set to true when there is an active "before unload" dialog. When true, |
| 612 | // we've forced the throbber to start in Navigate, and we need to remember to |
| 613 | // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled. |
| 614 | bool is_showing_before_unload_dialog_; |
| 615 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 616 | // Settings that get passed to the renderer process. |
[email protected] | daf82f8 | 2011-10-31 22:35:31 | [diff] [blame] | 617 | content::RendererPreferences renderer_preferences_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 618 | |
| 619 | // If this tab was created from a renderer using window.open, this will be |
| 620 | // non-NULL and represent the WebUI of the opening renderer. |
[email protected] | 1fd1a50 | 2011-03-30 16:55:56 | [diff] [blame] | 621 | WebUI::TypeID opener_web_ui_type_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 622 | |
| 623 | // The time that we started to create the new tab page. |
| 624 | base::TimeTicks new_tab_start_time_; |
| 625 | |
| 626 | // The time that we started to close the tab. |
| 627 | base::TimeTicks tab_close_start_time_; |
| 628 | |
| 629 | // The time that this tab was last selected. |
| 630 | base::TimeTicks last_selected_time_; |
| 631 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 632 | // See description above setter. |
| 633 | bool closed_by_user_gesture_; |
| 634 | |
| 635 | // Minimum/maximum zoom percent. |
| 636 | int minimum_zoom_percent_; |
| 637 | int maximum_zoom_percent_; |
| 638 | // If true, the default zoom limits have been overriden for this tab, in which |
| 639 | // case we don't want saved settings to apply to it and we don't want to |
| 640 | // remember it. |
| 641 | bool temporary_zoom_settings_; |
| 642 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 643 | // Content restrictions, used to disable print/copy etc based on content's |
| 644 | // (full-page plugins for now only) permissions. |
| 645 | int content_restrictions_; |
| 646 | |
[email protected] | 32ded221 | 2011-11-10 18:51:43 | [diff] [blame] | 647 | // Our view type. Default is VIEW_TYPE_TAB_CONTENTS. |
| 648 | content::ViewType view_type_; |
| 649 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 650 | DISALLOW_COPY_AND_ASSIGN(TabContents); |
| 651 | }; |
| 652 | |
| 653 | #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |