summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
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/dom_ui
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/dom_ui')
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc13
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.h2
2 files changed, 11 insertions, 4 deletions
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index cb1fe1b..1775e1e 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/navigation_entry.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/render_view_host.h"
+#include "chrome/browser/sessions/session_types.h"
#include "chrome/browser/template_url.h"
#include "chrome/browser/user_data_manager.h"
#include "chrome/browser/user_metrics.h"
@@ -677,8 +678,13 @@ void RecentlyClosedTabsHandler::HandleGetRecentlyClosedTabs(
// GetTabRestoreService() can return NULL (i.e., when in Off the
// Record mode)
- if (tab_restore_service_)
+ if (tab_restore_service_) {
+ // This does nothing if the tabs have already been loaded or they
+ // shouldn't be loaded.
+ tab_restore_service_->LoadTabsFromLastSession();
+
tab_restore_service_->AddObserver(this);
+ }
}
if (tab_restore_service_)
@@ -726,10 +732,11 @@ bool RecentlyClosedTabsHandler::TabToValue(
const TabNavigation& current_navigation =
tab.navigations.at(tab.current_navigation_index);
- if (current_navigation.url == NewTabUIURL())
+ if (current_navigation.url() == NewTabUIURL())
return false;
- SetURLAndTitle(dictionary, current_navigation.title, current_navigation.url);
+ SetURLAndTitle(dictionary, current_navigation.title(),
+ current_navigation.url());
dictionary->SetString(L"type", L"tab");
return true;
}
diff --git a/chrome/browser/dom_ui/new_tab_ui.h b/chrome/browser/dom_ui/new_tab_ui.h
index 814e73a..4995b4d 100644
--- a/chrome/browser/dom_ui/new_tab_ui.h
+++ b/chrome/browser/dom_ui/new_tab_ui.h
@@ -9,7 +9,7 @@
#include "chrome/browser/dom_ui/dom_ui_host.h"
#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
#include "chrome/browser/history/history.h"
-#include "chrome/browser/tab_restore_service.h"
+#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/template_url_model.h"
class GURL;