Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: chrome/browser/sessions/tab_restore_service.h

Issue 92001: Restore closed tabs into new windows when necessary, and track the windows th... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/sessions/tab_restore_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SESSIONS_TAB_RESTORE_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_
6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_ 6 #define CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 // Indicates we finished loading the last tabs (but not necessarily the 162 // Indicates we finished loading the last tabs (but not necessarily the
163 // last session). 163 // last session).
164 LOADED_LAST_TABS = 1 << 3, 164 LOADED_LAST_TABS = 1 << 3,
165 165
166 // Indicates we finished loading the last session (but not necessarily the 166 // Indicates we finished loading the last session (but not necessarily the
167 // last tabs). 167 // last tabs).
168 LOADED_LAST_SESSION = 1 << 4 168 LOADED_LAST_SESSION = 1 << 4
169 }; 169 };
170 170
171 // Populates tabs->navigations from the NavigationController. 171 // Populates the tab's navigations from the NavigationController, and its
172 void PopulateTabFromController(NavigationController* controller, 172 // browser_id and tabstrip_index from the browser.
173 Tab* tab); 173 void PopulateTab(Tab* tab,
174 Browser* browser,
175 NavigationController* controller);
174 176
175 // Notifies observers the tabs have changed. 177 // Notifies observers the tabs have changed.
176 void NotifyTabsChanged(); 178 void NotifyTabsChanged();
177 179
178 // Adds |entry| to the list of entries. If |prune| is true |PruneAndNotify| 180 // Adds |entry| to the list of entries. If |prune| is true |PruneAndNotify|
179 // is invoked. If |to_front| is true the entry is added to the front, 181 // is invoked. If |to_front| is true the entry is added to the front,
180 // otherwise the back. Normal closes go to the front, but tab/window closes 182 // otherwise the back. Normal closes go to the front, but tab/window closes
181 // from the previous session are added to the back. 183 // from the previous session are added to the back.
182 void AddEntry(Entry* entry, bool prune, bool to_front); 184 void AddEntry(Entry* entry, bool prune, bool to_front);
183 185
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // Returns true if |tab| has more than one navigation. If |tab| has more 230 // Returns true if |tab| has more than one navigation. If |tab| has more
229 // than one navigation |tab->current_navigation_index| is constrained based 231 // than one navigation |tab->current_navigation_index| is constrained based
230 // on the number of navigations. 232 // on the number of navigations.
231 bool ValidateTab(Tab* tab); 233 bool ValidateTab(Tab* tab);
232 234
233 // Validates all entries in |entries|, deleting any with no navigations. 235 // Validates all entries in |entries|, deleting any with no navigations.
234 // This also deletes any entries beyond the max number of entries we can 236 // This also deletes any entries beyond the max number of entries we can
235 // hold. 237 // hold.
236 void ValidateAndDeleteEmptyEntries(std::vector<Entry*>* entries); 238 void ValidateAndDeleteEmptyEntries(std::vector<Entry*>* entries);
237 239
240 // Finds tab entries with the old browser_id and sets it to the new one.
241 void UpdateTabBrowserIDs(SessionID::id_type old_id,
242 SessionID::id_type new_id);
243
238 // Callback from SessionService when we've received the windows from the 244 // Callback from SessionService when we've received the windows from the
239 // previous session. This creates and add entries to |staging_entries_| 245 // previous session. This creates and add entries to |staging_entries_|
240 // and invokes LoadStateChanged. 246 // and invokes LoadStateChanged.
241 void OnGotPreviousSession(Handle handle, 247 void OnGotPreviousSession(Handle handle,
242 std::vector<SessionWindow*>* windows); 248 std::vector<SessionWindow*>* windows);
243 249
244 // Creates and add entries to |entries| for each of the windows in |windows|. 250 // Creates and add entries to |entries| for each of the windows in |windows|.
245 void CreateEntriesFromWindows( 251 void CreateEntriesFromWindows(
246 std::vector<SessionWindow*>* windows, 252 std::vector<SessionWindow*>* windows,
247 std::vector<Entry*>* entries); 253 std::vector<Entry*>* entries);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // Results from previously closed tabs/sessions is first added here. When 294 // Results from previously closed tabs/sessions is first added here. When
289 // the results from both us and the session restore service have finished 295 // the results from both us and the session restore service have finished
290 // loading LoadStateChanged is invoked, which adds these entries to 296 // loading LoadStateChanged is invoked, which adds these entries to
291 // entries_. 297 // entries_.
292 std::vector<Entry*> staging_entries_; 298 std::vector<Entry*> staging_entries_;
293 299
294 DISALLOW_COPY_AND_ASSIGN(TabRestoreService); 300 DISALLOW_COPY_AND_ASSIGN(TabRestoreService);
295 }; 301 };
296 302
297 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_ 303 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sessions/tab_restore_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698