diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-19 13:28:24 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-19 13:28:24 +0000 |
commit | fbc947b9ed8df318710ca92e7341d327784c6808 (patch) | |
tree | 18465ec253dc9eaed4e3fd8c78e9a9f7f6f40a14 /chrome/browser/browser.cc | |
parent | ef42ecf401127e5ea585c9d4b7b82ba9eda506f0 (diff) | |
download | chromium_src-fbc947b9ed8df318710ca92e7341d327784c6808.zip chromium_src-fbc947b9ed8df318710ca92e7341d327784c6808.tar.gz chromium_src-fbc947b9ed8df318710ca92e7341d327784c6808.tar.bz2 |
Implement restoring closed tab menu item. Reworked cross-platform code to handle the case of restoring when there are no browsers open by making window restore re-use a given browser if it has no tabs. Removed unit test that assumes it can pass a NULL Browser. Wrote a new UI test to cover the same area, but it's disabled until another bug is fixed, and I didn't want to hold up landing this feature. Added key shortcut for "open window in incognito mode".
BUG=13758
TEST=restoring closed tabs with visible windows and with no windows remaining open.
Review URL: http://codereview.chromium.org/125257
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18806 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 5bba572..0fe72e6 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -213,6 +213,7 @@ Browser::~Browser() { BrowserList::RemoveBrowser(this); +#if defined(OS_WIN) || defined(OS_LINUX) if (!BrowserList::HasBrowserWithProfile(profile_)) { // We're the last browser window with this profile. We need to nuke the // TabRestoreService, which will start the shutdown of the @@ -220,8 +221,12 @@ Browser::~Browser() { // chrome won't shutdown cleanly, and may end up crashing when some // thread tries to use the IO thread (or another thread) that is no longer // valid. + // This isn't a valid assumption for Mac OS, as it stays running after + // the last browser has closed. The Mac equivalent is in its app + // controller. profile_->ResetTabRestoreService(); } +#endif SessionService* session_service = profile_->GetSessionService(); if (session_service) @@ -315,6 +320,13 @@ void Browser::OpenEmptyWindow(Profile* profile) { } // static +void Browser::OpenWindowWithRestoredTabs(Profile* profile) { + TabRestoreService* service = profile->GetTabRestoreService(); + if (service) + service->RestoreMostRecentEntry(NULL); +} + +// static void Browser::OpenURLOffTheRecord(Profile* profile, const GURL& url) { Profile* off_the_record_profile = profile->GetOffTheRecordProfile(); Browser* browser = BrowserList::FindBrowserWithType( |