| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 virtual WebUI* GetCommittedWebUI() const = 0; | 120 virtual WebUI* GetCommittedWebUI() const = 0; |
| 121 | 121 |
| 122 // Tab navigation state ------------------------------------------------------ | 122 // Tab navigation state ------------------------------------------------------ |
| 123 | 123 |
| 124 // Returns the current navigation properties, which if a navigation is | 124 // Returns the current navigation properties, which if a navigation is |
| 125 // pending may be provisional (e.g., the navigation could result in a | 125 // pending may be provisional (e.g., the navigation could result in a |
| 126 // download, in which case the URL would revert to what it was previously). | 126 // download, in which case the URL would revert to what it was previously). |
| 127 virtual const string16& GetTitle() const = 0; | 127 virtual const string16& GetTitle() const = 0; |
| 128 | 128 |
| 129 // The max page ID for any page that the current SiteInstance has loaded in | 129 // The max page ID for any page that the current SiteInstance has loaded in |
| 130 // this TabContents. Page IDs are specific to a given SiteInstance and | 130 // this WebContents. Page IDs are specific to a given SiteInstance and |
| 131 // TabContents, corresponding to a specific RenderView in the renderer. | 131 // WebContents, corresponding to a specific RenderView in the renderer. |
| 132 // Page IDs increase with each new page that is loaded by a tab. | 132 // Page IDs increase with each new page that is loaded by a tab. |
| 133 virtual int32 GetMaxPageID() = 0; | 133 virtual int32 GetMaxPageID() = 0; |
| 134 | 134 |
| 135 // The max page ID for any page that the given SiteInstance has loaded in | 135 // The max page ID for any page that the given SiteInstance has loaded in |
| 136 // this TabContents. | 136 // this WebContents. |
| 137 virtual int32 GetMaxPageIDForSiteInstance( | 137 virtual int32 GetMaxPageIDForSiteInstance(SiteInstance* site_instance) = 0; |
| 138 SiteInstance* site_instance) = 0; | |
| 139 | 138 |
| 140 // Returns the SiteInstance associated with the current page. | 139 // Returns the SiteInstance associated with the current page. |
| 141 virtual SiteInstance* GetSiteInstance() const = 0; | 140 virtual SiteInstance* GetSiteInstance() const = 0; |
| 142 | 141 |
| 143 // Returns the SiteInstance for the pending navigation, if any. Otherwise | 142 // Returns the SiteInstance for the pending navigation, if any. Otherwise |
| 144 // returns the current SiteInstance. | 143 // returns the current SiteInstance. |
| 145 virtual SiteInstance* GetPendingSiteInstance() const = 0; | 144 virtual SiteInstance* GetPendingSiteInstance() const = 0; |
| 146 | 145 |
| 147 // Return whether this tab contents is loading a resource. | 146 // Return whether this tab contents is loading a resource. |
| 148 virtual bool IsLoading() const = 0; | 147 virtual bool IsLoading() const = 0; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // Adds a new tab or window with the given already-created contents. | 219 // Adds a new tab or window with the given already-created contents. |
| 221 virtual void AddNewContents(WebContents* new_contents, | 220 virtual void AddNewContents(WebContents* new_contents, |
| 222 WindowOpenDisposition disposition, | 221 WindowOpenDisposition disposition, |
| 223 const gfx::Rect& initial_pos, | 222 const gfx::Rect& initial_pos, |
| 224 bool user_gesture) = 0; | 223 bool user_gesture) = 0; |
| 225 | 224 |
| 226 // Views and focus ----------------------------------------------------------- | 225 // Views and focus ----------------------------------------------------------- |
| 227 // TODO(brettw): Most of these should be removed and the caller should call | 226 // TODO(brettw): Most of these should be removed and the caller should call |
| 228 // the view directly. | 227 // the view directly. |
| 229 | 228 |
| 230 // Returns the actual window that is focused when this TabContents is shown. | 229 // Returns the actual window that is focused when this WebContents is shown. |
| 231 virtual gfx::NativeView GetContentNativeView() const = 0; | 230 virtual gfx::NativeView GetContentNativeView() const = 0; |
| 232 | 231 |
| 233 // Returns the NativeView associated with this TabContents. Outside of | 232 // Returns the NativeView associated with this WebContents. Outside of |
| 234 // automation in the context of the UI, this is required to be implemented. | 233 // automation in the context of the UI, this is required to be implemented. |
| 235 virtual gfx::NativeView GetNativeView() const = 0; | 234 virtual gfx::NativeView GetNativeView() const = 0; |
| 236 | 235 |
| 237 // Returns the bounds of this TabContents in the screen coordinate system. | 236 // Returns the bounds of this WebContents in the screen coordinate system. |
| 238 virtual void GetContainerBounds(gfx::Rect* out) const = 0; | 237 virtual void GetContainerBounds(gfx::Rect* out) const = 0; |
| 239 | 238 |
| 240 // Makes the tab the focused window. | 239 // Makes the tab the focused window. |
| 241 virtual void Focus() = 0; | 240 virtual void Focus() = 0; |
| 242 | 241 |
| 243 // Focuses the first (last if |reverse| is true) element in the page. | 242 // Focuses the first (last if |reverse| is true) element in the page. |
| 244 // Invoked when this tab is getting the focus through tab traversal (|reverse| | 243 // Invoked when this tab is getting the focus through tab traversal (|reverse| |
| 245 // is true when using Shift-Tab). | 244 // is true when using Shift-Tab). |
| 246 virtual void FocusThroughTabTraversal(bool reverse) = 0; | 245 virtual void FocusThroughTabTraversal(bool reverse) = 0; |
| 247 | 246 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 275 const FilePath& file, | 274 const FilePath& file, |
| 276 const base::Callback<void(const FilePath& /* path to the MHTML file */, | 275 const base::Callback<void(const FilePath& /* path to the MHTML file */, |
| 277 int64 /* size of the file */)>& callback) = 0; | 276 int64 /* size of the file */)>& callback) = 0; |
| 278 | 277 |
| 279 // Returns true if the active NavigationEntry's page_id equals page_id. | 278 // Returns true if the active NavigationEntry's page_id equals page_id. |
| 280 virtual bool IsActiveEntry(int32 page_id) = 0; | 279 virtual bool IsActiveEntry(int32 page_id) = 0; |
| 281 | 280 |
| 282 // Returns the contents MIME type after a navigation. | 281 // Returns the contents MIME type after a navigation. |
| 283 virtual const std::string& GetContentsMimeType() const = 0; | 282 virtual const std::string& GetContentsMimeType() const = 0; |
| 284 | 283 |
| 285 // Returns true if this TabContents will notify about disconnection. | 284 // Returns true if this WebContents will notify about disconnection. |
| 286 virtual bool WillNotifyDisconnection() const = 0; | 285 virtual bool WillNotifyDisconnection() const = 0; |
| 287 | 286 |
| 288 // Override the encoding and reload the page by sending down | 287 // Override the encoding and reload the page by sending down |
| 289 // ViewMsg_SetPageEncoding to the renderer. |UpdateEncoding| is kinda | 288 // ViewMsg_SetPageEncoding to the renderer. |UpdateEncoding| is kinda |
| 290 // the opposite of this, by which 'browser' is notified of | 289 // the opposite of this, by which 'browser' is notified of |
| 291 // the encoding of the current tab from 'renderer' (determined by | 290 // the encoding of the current tab from 'renderer' (determined by |
| 292 // auto-detect, http header, meta, bom detection, etc). | 291 // auto-detect, http header, meta, bom detection, etc). |
| 293 virtual void SetOverrideEncoding(const std::string& encoding) = 0; | 292 virtual void SetOverrideEncoding(const std::string& encoding) = 0; |
| 294 | 293 |
| 295 // Remove any user-defined override encoding and reload by sending down | 294 // Remove any user-defined override encoding and reload by sending down |
| 296 // ViewMsg_ResetPageEncodingToDefault to the renderer. | 295 // ViewMsg_ResetPageEncodingToDefault to the renderer. |
| 297 virtual void ResetOverrideEncoding() = 0; | 296 virtual void ResetOverrideEncoding() = 0; |
| 298 | 297 |
| 299 // Returns the settings which get passed to the renderer. | 298 // Returns the settings which get passed to the renderer. |
| 300 virtual content::RendererPreferences* GetMutableRendererPrefs() = 0; | 299 virtual content::RendererPreferences* GetMutableRendererPrefs() = 0; |
| 301 | 300 |
| 302 // Set the time when we started to create the new tab page. This time is | 301 // Set the time when we started to create the new tab page. This time is |
| 303 // from before we created this TabContents. | 302 // from before we created this WebContents. |
| 304 virtual void SetNewTabStartTime(const base::TimeTicks& time) = 0; | 303 virtual void SetNewTabStartTime(const base::TimeTicks& time) = 0; |
| 305 virtual base::TimeTicks GetNewTabStartTime() const = 0; | 304 virtual base::TimeTicks GetNewTabStartTime() const = 0; |
| 306 | 305 |
| 307 // Notification that tab closing has started. This can be called multiple | 306 // Notification that tab closing has started. This can be called multiple |
| 308 // times, subsequent calls are ignored. | 307 // times, subsequent calls are ignored. |
| 309 virtual void OnCloseStarted() = 0; | 308 virtual void OnCloseStarted() = 0; |
| 310 | 309 |
| 311 // Returns true if underlying WebContentsView should accept drag-n-drop. | 310 // Returns true if underlying WebContentsView should accept drag-n-drop. |
| 312 virtual bool ShouldAcceptDragAndDrop() const = 0; | 311 virtual bool ShouldAcceptDragAndDrop() const = 0; |
| 313 | 312 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 // Focuses the location bar. | 371 // Focuses the location bar. |
| 373 virtual void SetFocusToLocationBar(bool select_all) = 0; | 372 virtual void SetFocusToLocationBar(bool select_all) = 0; |
| 374 | 373 |
| 375 // Does this have an opener associated with it? | 374 // Does this have an opener associated with it? |
| 376 virtual bool HasOpener() const = 0; | 375 virtual bool HasOpener() const = 0; |
| 377 }; | 376 }; |
| 378 | 377 |
| 379 } // namespace content | 378 } // namespace content |
| 380 | 379 |
| 381 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ | 380 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_H_ |
| OLD | NEW |