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

Side by Side Diff: chrome/browser/sessions/session_restore.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
« no previous file with comments | « chrome/browser/dom_ui/value_helper.cc ('k') | chrome/browser/sessions/session_restore.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_SESSION_RESTORE_H_ 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_
6 #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ 6 #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "chrome/browser/history/history.h" 11 #include "chrome/browser/history/history.h"
12 #include "chrome/browser/sessions/session_types.h"
12 #include "base/basictypes.h" 13 #include "base/basictypes.h"
13 14
14 class Browser; 15 class Browser;
15 class Profile; 16 class Profile;
16 17
17 // SessionRestore handles restoring either the last or saved session. Session 18 // SessionRestore handles restoring either the last or saved session. Session
18 // restore come in two variants, asynchronous or synchronous. The synchronous 19 // restore come in two variants, asynchronous or synchronous. The synchronous
19 // variety is meant for startup, and blocks until restore is complete. 20 // variety is meant for startup, and blocks until restore is complete.
20 class SessionRestore { 21 class SessionRestore {
21 public: 22 public:
22 // Asnchronously restores the specified session. 23 // Asnchronously restores the specified session.
23 // If |browser| is non-null the tabs for the first window are added to it. 24 // If |browser| is non-null the tabs for the first window are added to it.
24 // If clobber_existing_window is true and there is an open browser window, 25 // If clobber_existing_window is true and there is an open browser window,
25 // it is closed after restoring. 26 // it is closed after restoring.
26 // If always_create_tabbed_browser is true at least one tabbed browser is 27 // If always_create_tabbed_browser is true at least one tabbed browser is
27 // created. For example, if there is an error restoring, or the last session 28 // created. For example, if there is an error restoring, or the last session
28 // session is empty and always_create_tabbed_browser is true, a new empty 29 // session is empty and always_create_tabbed_browser is true, a new empty
29 // tabbed browser is created. 30 // tabbed browser is created.
30 // 31 //
31 // If urls_to_open is non-empty, a tab is added for each of the URLs. 32 // If urls_to_open is non-empty, a tab is added for each of the URLs.
32 static void RestoreSession(Profile* profile, 33 static void RestoreSession(Profile* profile,
33 Browser* browser, 34 Browser* browser,
34 bool clobber_existing_window, 35 bool clobber_existing_window,
35 bool always_create_tabbed_browser, 36 bool always_create_tabbed_browser,
36 const std::vector<GURL>& urls_to_open); 37 const std::vector<GURL>& urls_to_open);
37 38
39 // Specifically used in the restoration of a foreign session. This method
40 // restores the given session windows to a browser.
41 static void RestoreForeignSessionWindows(Profile* profile,
42 std::vector<SessionWindow*>* windows);
43
38 // Synchronously restores the last session. At least one tabbed browser is 44 // Synchronously restores the last session. At least one tabbed browser is
39 // created, even if there is an error in restoring. 45 // created, even if there is an error in restoring.
40 // 46 //
41 // If urls_to_open is non-empty, a tab is added for each of the URLs. 47 // If urls_to_open is non-empty, a tab is added for each of the URLs.
42 static void RestoreSessionSynchronously( 48 static void RestoreSessionSynchronously(
43 Profile* profile, 49 Profile* profile,
44 const std::vector<GURL>& urls_to_open); 50 const std::vector<GURL>& urls_to_open);
45 51
46 // Returns true if we're in the process of restoring. 52 // Returns true if we're in the process of restoring.
47 static bool IsRestoring(); 53 static bool IsRestoring();
48 54
49 // The max number of non-selected tabs SessionRestore loads when restoring 55 // The max number of non-selected tabs SessionRestore loads when restoring
50 // a session. A value of 0 indicates all tabs are loaded at once. 56 // a session. A value of 0 indicates all tabs are loaded at once.
51 static size_t num_tabs_to_load_; 57 static size_t num_tabs_to_load_;
52 58
53 private: 59 private:
54 SessionRestore(); 60 SessionRestore();
55 61
56 DISALLOW_COPY_AND_ASSIGN(SessionRestore); 62 DISALLOW_COPY_AND_ASSIGN(SessionRestore);
57 }; 63 };
58 64
59 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_ 65 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/value_helper.cc ('k') | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698