summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sessions/session_restore.h
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-06 19:30:19 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-06 19:30:19 +0000
commit169627b81ce036a7014476c366b060e050b5ff70 (patch)
tree6231d8cfaa065513b4742d99204b25da4178037a /chrome/browser/sessions/session_restore.h
parentee824a436efbdeed4ca78efc4dd2aa4976ba43a9 (diff)
downloadchromium_src-169627b81ce036a7014476c366b060e050b5ff70.zip
chromium_src-169627b81ce036a7014476c366b060e050b5ff70.tar.gz
chromium_src-169627b81ce036a7014476c366b060e050b5ff70.tar.bz2
Makes the tab restore service persist closed tabs/windows to disk and
reload them when asked. Sorry for largish looking change. It's made big by refactoring common code between TabRestoreService and SessionService into a common superclass. At the same time I removed some dead code and shuffled the session related classes into a single directory for easier perusal. BUG=384 TEST=close the browser, start the browser and make sure the new tab page shows closed windows/tabs from the previous session. Review URL: http://codereview.chromium.org/13152 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6490 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sessions/session_restore.h')
-rw-r--r--chrome/browser/sessions/session_restore.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/chrome/browser/sessions/session_restore.h b/chrome/browser/sessions/session_restore.h
new file mode 100644
index 0000000..eb44d9a
--- /dev/null
+++ b/chrome/browser/sessions/session_restore.h
@@ -0,0 +1,55 @@
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_
+#define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_
+
+#include <vector>
+
+#include "chrome/browser/history/history.h"
+#include "base/basictypes.h"
+
+class Browser;
+class Profile;
+
+// SessionRestore handles restoring either the last or saved session. Session
+// restore come in two variants, asynchronous or synchronous. The synchronous
+// variety is meant for startup, and blocks until restore is complete.
+class SessionRestore {
+ public:
+ // Asnchronously restores the specified session.
+ // If |browser| is non-null the tabs for the first window are added to it.
+ // If clobber_existing_window is true and there is an open browser window,
+ // it is closed after restoring.
+ // If always_create_tabbed_browser is true at least one tabbed browser is
+ // created. For example, if there is an error restoring, or the last session
+ // session is empty and always_create_tabbed_browser is true, a new empty
+ // tabbed browser is created.
+ //
+ // If urls_to_open is non-empty, a tab is added for each of the URLs.
+ static void RestoreSession(Profile* profile,
+ Browser* browser,
+ bool clobber_existing_window,
+ bool always_create_tabbed_browser,
+ const std::vector<GURL>& urls_to_open);
+
+ // Synchronously restores the last session. At least one tabbed browser is
+ // created, even if there is an error in restoring.
+ //
+ // If urls_to_open is non-empty, a tab is added for each of the URLs.
+ static void RestoreSessionSynchronously(
+ Profile* profile,
+ const std::vector<GURL>& urls_to_open);
+
+ // The max number of non-selected tabs SessionRestore loads when restoring
+ // a session. A value of 0 indicates all tabs are loaded at once.
+ static size_t num_tabs_to_load_;
+
+ private:
+ SessionRestore();
+
+ DISALLOW_COPY_AND_ASSIGN(SessionRestore);
+};
+
+#endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_H_