OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_TAB_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 // The max PageID of any page that this TabContents has loaded. PageIDs | 128 // The max PageID of any page that this TabContents has loaded. PageIDs |
129 // increase with each new page that is loaded by a tab. If this is a | 129 // increase with each new page that is loaded by a tab. If this is a |
130 // WebContents, then the max PageID is kept separately on each SiteInstance. | 130 // WebContents, then the max PageID is kept separately on each SiteInstance. |
131 // Returns -1 if no PageIDs have yet been seen. | 131 // Returns -1 if no PageIDs have yet been seen. |
132 int32 GetMaxPageID(); | 132 int32 GetMaxPageID(); |
133 | 133 |
134 // Updates the max PageID to be at least the given PageID. | 134 // Updates the max PageID to be at least the given PageID. |
135 void UpdateMaxPageID(int32 page_id); | 135 void UpdateMaxPageID(int32 page_id); |
136 | 136 |
| 137 // Returns the site instance associated with the current page. By default, |
| 138 // there is no site instance. WebContents overrides this to provide proper |
| 139 // access to its site instance. |
| 140 virtual SiteInstance* GetSiteInstance() const { return NULL; } |
| 141 |
137 // Initial title assigned to NavigationEntries from Navigate. | 142 // Initial title assigned to NavigationEntries from Navigate. |
138 virtual const std::wstring GetDefaultTitle() const; | 143 virtual const std::wstring GetDefaultTitle() const; |
139 | 144 |
140 // Defines whether the url should be displayed within the browser. If false | 145 // Defines whether the url should be displayed within the browser. If false |
141 // is returned, the URL field is blank and grabs focus to invite the user | 146 // is returned, the URL field is blank and grabs focus to invite the user |
142 // to type a new url | 147 // to type a new url |
143 virtual bool ShouldDisplayURL() { return true; } | 148 virtual bool ShouldDisplayURL() { return true; } |
144 | 149 |
145 // Returns the favicon for this tab, or an isNull() bitmap if the tab does not | 150 // Returns the favicon for this tab, or an isNull() bitmap if the tab does not |
146 // have a favicon. The default implementation uses the current navigation | 151 // have a favicon. The default implementation uses the current navigation |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 // and external resource. | 272 // and external resource. |
268 bool response_started() const { return response_started_; } | 273 bool response_started() const { return response_started_; } |
269 | 274 |
270 // Set whether this tab contents is active. A tab content is active for a | 275 // Set whether this tab contents is active. A tab content is active for a |
271 // given tab if it is currently being used to display some contents. Note that | 276 // given tab if it is currently being used to display some contents. Note that |
272 // this is different from whether a tab is selected. | 277 // this is different from whether a tab is selected. |
273 virtual void SetActive(bool active) { is_active_ = active; } | 278 virtual void SetActive(bool active) { is_active_ = active; } |
274 bool is_active() const { return is_active_; } | 279 bool is_active() const { return is_active_; } |
275 | 280 |
276 // Called by the NavigationController to cause the TabContents to navigate to | 281 // Called by the NavigationController to cause the TabContents to navigate to |
277 // the specified entry. Either TabContents::DidNavigateToEntry or the | 282 // the current pending entry. The NavigationController should be called back |
278 // navigation controller's DiscardPendingEntry method should be called in | 283 // with CommitPendingEntry/RendererDidNavigate on success or |
279 // response (possibly sometime later). | 284 // DiscardPendingEntry. The callbacks can be inside of this function, or at |
| 285 // some future time. |
280 // | 286 // |
281 // The entry has a PageID of -1 if newly created (corresponding to navigation | 287 // The entry has a PageID of -1 if newly created (corresponding to navigation |
282 // to a new URL). | 288 // to a new URL). |
283 // | 289 // |
284 // If this method returns false, then the navigation is discarded (equivalent | 290 // If this method returns false, then the navigation is discarded (equivalent |
285 // to calling DiscardPendingEntry on the NavigationController). | 291 // to calling DiscardPendingEntry on the NavigationController). |
286 // | 292 virtual bool NavigateToPendingEntry(bool reload); |
287 virtual bool Navigate(const NavigationEntry& entry, bool reload); | |
288 | 293 |
289 // Stop any pending navigation. | 294 // Stop any pending navigation. |
290 virtual void Stop() {} | 295 virtual void Stop() {} |
291 | 296 |
292 // Convenience method for notifying the delegate of a navigation state | 297 // Convenience method for notifying the delegate of a navigation state |
293 // change. See TabContentsDelegate. | 298 // change. See TabContentsDelegate. |
294 void NotifyNavigationStateChanged(unsigned changed_flags); | 299 void NotifyNavigationStateChanged(unsigned changed_flags); |
295 | 300 |
296 // Convenience method for notifying the delegate of a navigation. | 301 // Convenience method for notifying the delegate of a navigation. |
297 // See TabContentsDelegate. | 302 // See TabContentsDelegate. |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 485 |
481 // Set focus on the initial component. This is invoked from | 486 // Set focus on the initial component. This is invoked from |
482 // RestoreFocus if SetLastFocusOwner has not yet been invoked. | 487 // RestoreFocus if SetLastFocusOwner has not yet been invoked. |
483 virtual void SetInitialFocus(); | 488 virtual void SetInitialFocus(); |
484 | 489 |
485 // Changes the IsLoading state and notifies delegate as needed | 490 // Changes the IsLoading state and notifies delegate as needed |
486 // |details| is used to provide details on the load that just finished | 491 // |details| is used to provide details on the load that just finished |
487 // (but can be null if not applicable) | 492 // (but can be null if not applicable) |
488 void SetIsLoading(bool is_loading, LoadNotificationDetails* details); | 493 void SetIsLoading(bool is_loading, LoadNotificationDetails* details); |
489 | 494 |
490 // Called by subclasses when a navigation occurs. Ownership of the entry | |
491 // object is passed to this method. The details object should be filled in | |
492 // *except* for the entry (which the NavigationController will set). This | |
493 // behaves the same as NavigationController::DidNavigate, see that for more. | |
494 void DidNavigateToEntry(NavigationEntry* entry, | |
495 NavigationController::LoadCommittedDetails* details); | |
496 | |
497 // Called by a derived class when the TabContents is resized, causing | 495 // Called by a derived class when the TabContents is resized, causing |
498 // suppressed constrained web popups to be repositioned to the new bounds | 496 // suppressed constrained web popups to be repositioned to the new bounds |
499 // if necessary. | 497 // if necessary. |
500 void RepositionSupressedPopupsToFit(const gfx::Size& new_size); | 498 void RepositionSupressedPopupsToFit(const gfx::Size& new_size); |
501 | 499 |
502 // Releases the download shelf. This method is used by MigrateShelfViewFrom. | 500 // Releases the download shelf. This method is used by MigrateShelfViewFrom. |
503 // Sub-classes should clear any pointer they might keep to the shelf view and | 501 // Sub-classes should clear any pointer they might keep to the shelf view and |
504 // invoke TabContents::ReleaseDownloadShelfView(). | 502 // invoke TabContents::ReleaseDownloadShelfView(). |
505 virtual void ReleaseDownloadShelfView(); | 503 virtual void ReleaseDownloadShelfView(); |
506 | 504 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 int32 max_page_id_; | 536 int32 max_page_id_; |
539 | 537 |
540 // The id used in the ViewStorage to store the last focused view. | 538 // The id used in the ViewStorage to store the last focused view. |
541 int last_focused_view_storage_id_; | 539 int last_focused_view_storage_id_; |
542 | 540 |
543 std::string encoding_name_; | 541 std::string encoding_name_; |
544 }; | 542 }; |
545 | 543 |
546 #endif // CHROME_BROWSER_TAB_CONTENTS_H_ | 544 #endif // CHROME_BROWSER_TAB_CONTENTS_H_ |
547 | 545 |
OLD | NEW |