OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_NAVIGATION_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 return profile_; | 143 return profile_; |
144 } | 144 } |
145 | 145 |
146 // Sets the profile for this controller. | 146 // Sets the profile for this controller. |
147 void set_profile(Profile* profile) { | 147 void set_profile(Profile* profile) { |
148 profile_ = profile; | 148 profile_ = profile; |
149 } | 149 } |
150 | 150 |
151 // Initializes this NavigationController with the given saved navigations, | 151 // Initializes this NavigationController with the given saved navigations, |
152 // using selected_navigation as the currently loaded entry. Before this call | 152 // using selected_navigation as the currently loaded entry. Before this call |
153 // the controller should be unused (there should be no current entry). This is | 153 // the controller should be unused (there should be no current entry). If |
154 // used for session restore. | 154 // from_last_session is true, navigations are from the previous session, |
| 155 // otherwise they are from the current session (undo tab close). |
| 156 // This is used for session restore. |
155 void RestoreFromState(const std::vector<TabNavigation>& navigations, | 157 void RestoreFromState(const std::vector<TabNavigation>& navigations, |
156 int selected_navigation); | 158 int selected_navigation, bool from_last_session); |
157 | 159 |
158 // Active entry -------------------------------------------------------------- | 160 // Active entry -------------------------------------------------------------- |
159 | 161 |
160 // Returns the active entry, which is the transient entry if any, the pending | 162 // Returns the active entry, which is the transient entry if any, the pending |
161 // entry if a navigation is in progress or the last committed entry otherwise. | 163 // entry if a navigation is in progress or the last committed entry otherwise. |
162 // NOTE: This can be NULL!! | 164 // NOTE: This can be NULL!! |
163 // | 165 // |
164 // If you are trying to get the current state of the NavigationController, | 166 // If you are trying to get the current state of the NavigationController, |
165 // this is the method you will typically want to call. | 167 // this is the method you will typically want to call. |
166 NavigationEntry* GetActiveEntry() const; | 168 NavigationEntry* GetActiveEntry() const; |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 | 436 |
435 // Sets the max restored page ID this NavigationController has seen, if it | 437 // Sets the max restored page ID this NavigationController has seen, if it |
436 // was restored from a previous session. | 438 // was restored from a previous session. |
437 void set_max_restored_page_id(int max_id) { max_restored_page_id_ = max_id; } | 439 void set_max_restored_page_id(int max_id) { max_restored_page_id_ = max_id; } |
438 | 440 |
439 NavigationEntry* CreateNavigationEntry(const GURL& url, const GURL& referrer, | 441 NavigationEntry* CreateNavigationEntry(const GURL& url, const GURL& referrer, |
440 PageTransition::Type transition); | 442 PageTransition::Type transition); |
441 | 443 |
442 // Invoked after session/tab restore or cloning a tab. Resets the transition | 444 // Invoked after session/tab restore or cloning a tab. Resets the transition |
443 // type of the entries, updates the max page id and creates the active | 445 // type of the entries, updates the max page id and creates the active |
444 // contents. | 446 // contents. See RestoreFromState for a description of from_last_session. |
445 void FinishRestore(int selected_index); | 447 void FinishRestore(int selected_index, bool from_last_session); |
446 | 448 |
447 // Inserts a new entry or replaces the current entry with a new one, removing | 449 // Inserts a new entry or replaces the current entry with a new one, removing |
448 // all entries after it. The new entry will become the active one. | 450 // all entries after it. The new entry will become the active one. |
449 void InsertOrReplaceEntry(NavigationEntry* entry, bool replace); | 451 void InsertOrReplaceEntry(NavigationEntry* entry, bool replace); |
450 | 452 |
451 // Discards the pending and transient entries. | 453 // Discards the pending and transient entries. |
452 void DiscardNonCommittedEntriesInternal(); | 454 void DiscardNonCommittedEntriesInternal(); |
453 | 455 |
454 // Discards the transient entry. | 456 // Discards the transient entry. |
455 void DiscardTransientEntry(); | 457 void DiscardTransientEntry(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 // when testing. | 528 // when testing. |
527 static bool check_for_repost_; | 529 static bool check_for_repost_; |
528 | 530 |
529 // The maximum number of entries that a navigation controller can store. | 531 // The maximum number of entries that a navigation controller can store. |
530 static size_t max_entry_count_; | 532 static size_t max_entry_count_; |
531 | 533 |
532 DISALLOW_COPY_AND_ASSIGN(NavigationController); | 534 DISALLOW_COPY_AND_ASSIGN(NavigationController); |
533 }; | 535 }; |
534 | 536 |
535 #endif // CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ | 537 #endif // CHROME_BROWSER_TAB_CONTENTS_NAVIGATION_CONTROLLER_H_ |
OLD | NEW |