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

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

Issue 3133022: sync: take two for: "Added classes to enable session sync... (Closed)
Patch Set: Created 10 years, 4 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
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 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <set> 10 #include <set>
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 SessionID::id_type id, 168 SessionID::id_type id,
169 bool replace_existing_tab); 169 bool replace_existing_tab);
170 170
171 // Loads the tabs and previous session. This does nothing if the tabs 171 // Loads the tabs and previous session. This does nothing if the tabs
172 // from the previous session have already been loaded. 172 // from the previous session have already been loaded.
173 void LoadTabsFromLastSession(); 173 void LoadTabsFromLastSession();
174 174
175 // Max number of entries we'll keep around. 175 // Max number of entries we'll keep around.
176 static const size_t kMaxEntries; 176 static const size_t kMaxEntries;
177 177
178 // Creates and add entries to |entries| for each of the windows in |windows|.
179 void CreateEntriesFromWindows(std::vector<SessionWindow*>* windows,
180 std::vector<Entry*>* entries);
181
178 protected: 182 protected:
179 virtual void Save(); 183 virtual void Save();
180 184
181 virtual ~TabRestoreService(); 185 virtual ~TabRestoreService();
182 186
183 private: 187 private:
184 // Used to indicate what has loaded. 188 // Used to indicate what has loaded.
185 enum LoadState { 189 enum LoadState {
186 // Indicates we haven't loaded anything. 190 // Indicates we haven't loaded anything.
187 NOT_LOADED = 1 << 0, 191 NOT_LOADED = 1 << 0,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 // Finds tab entries with the old browser_id and sets it to the new one. 288 // Finds tab entries with the old browser_id and sets it to the new one.
285 void UpdateTabBrowserIDs(SessionID::id_type old_id, 289 void UpdateTabBrowserIDs(SessionID::id_type old_id,
286 SessionID::id_type new_id); 290 SessionID::id_type new_id);
287 291
288 // Callback from SessionService when we've received the windows from the 292 // Callback from SessionService when we've received the windows from the
289 // previous session. This creates and add entries to |staging_entries_| 293 // previous session. This creates and add entries to |staging_entries_|
290 // and invokes LoadStateChanged. 294 // and invokes LoadStateChanged.
291 void OnGotPreviousSession(Handle handle, 295 void OnGotPreviousSession(Handle handle,
292 std::vector<SessionWindow*>* windows); 296 std::vector<SessionWindow*>* windows);
293 297
294 // Creates and add entries to |entries| for each of the windows in |windows|.
295 void CreateEntriesFromWindows(
296 std::vector<SessionWindow*>* windows,
297 std::vector<Entry*>* entries);
298
299 // Converts a SessionWindow into a Window, returning true on success. We use 0 298 // Converts a SessionWindow into a Window, returning true on success. We use 0
300 // as the timestamp here since we do not know when the window/tab was closed. 299 // as the timestamp here since we do not know when the window/tab was closed.
301 bool ConvertSessionWindowToWindow( 300 bool ConvertSessionWindowToWindow(
302 SessionWindow* session_window, 301 SessionWindow* session_window,
303 Window* window); 302 Window* window);
304 303
305 // Invoked when previous tabs or session is loaded. If both have finished 304 // Invoked when previous tabs or session is loaded. If both have finished
306 // loading the entries in staging_entries_ are added to entries_ and 305 // loading the entries in staging_entries_ are added to entries_ and
307 // observers are notified. 306 // observers are notified.
308 void LoadStateChanged(); 307 void LoadStateChanged();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // entries_. 344 // entries_.
346 std::vector<Entry*> staging_entries_; 345 std::vector<Entry*> staging_entries_;
347 346
348 TimeFactory* time_factory_; 347 TimeFactory* time_factory_;
349 348
350 DISALLOW_COPY_AND_ASSIGN(TabRestoreService); 349 DISALLOW_COPY_AND_ASSIGN(TabRestoreService);
351 }; 350 };
352 351
353 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_ 352 #endif // CHROME_BROWSER_SESSIONS_TAB_RESTORE_SERVICE_H_
354 353
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_types.cc ('k') | chrome/browser/sync/abstract_profile_sync_service_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698