diff options
author | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-12 02:56:20 +0000 |
---|---|---|
committer | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-12 02:56:20 +0000 |
commit | 057d959ad8fa954e5ead634ff1d29e4d75f28678 (patch) | |
tree | 8a3f0aebaafd0b79c80553f123cc09abb979b171 | |
parent | a319876d697104c82098cac206e06dfba12a2a1c (diff) | |
download | chromium_src-057d959ad8fa954e5ead634ff1d29e4d75f28678.zip chromium_src-057d959ad8fa954e5ead634ff1d29e4d75f28678.tar.gz chromium_src-057d959ad8fa954e5ead634ff1d29e4d75f28678.tar.bz2 |
Bookmark manager: Make sure we open the tabbed bookmark manager in a non OTR window.
BUG=38008
TEST=Press Ctrl+Shift+B when in an incognito window
Review URL: http://codereview.chromium.org/909001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41385 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser.cc | 23 | ||||
-rw-r--r-- | chrome/browser/browser.h | 4 |
2 files changed, 22 insertions, 5 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 4bec672..00cccfa 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -392,7 +392,6 @@ void Browser::OpenApplicationWindow(Profile* profile, const GURL& url, } } -#if defined(OS_MACOSX) // static void Browser::OpenBookmarkManagerWindow(Profile* profile) { Browser* browser = Browser::Create(profile); @@ -400,6 +399,7 @@ void Browser::OpenBookmarkManagerWindow(Profile* profile) { browser->window()->Show(); } +#if defined(OS_MACOSX) // static void Browser::OpenHistoryWindow(Profile* profile) { Browser* browser = Browser::Create(profile); @@ -1295,7 +1295,7 @@ void Browser::ToggleExtensionShelf() { void Browser::OpenBookmarkManager() { UserMetrics::RecordAction("ShowBookmarkManager", profile_); if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableTabbedBookmarkManager)) { + switches::kEnableTabbedBookmarkManager)) { ShowBookmarkManagerTab(); } else { window_->ShowBookmarkManager(); @@ -1313,8 +1313,23 @@ void Browser::ShowPageMenu() { } void Browser::ShowBookmarkManagerTab() { - UserMetrics::RecordAction("ShowBookmarks", profile_); - ShowSingletonTab(GURL(chrome::kChromeUIBookmarksURL)); + // The bookmark manager tab does not work in incognito mode. If we are OTR + // we try to reuse the last active window and if that fails we open a new + // window. + Profile* default_profile = profile_->GetOriginalProfile(); + UserMetrics::RecordAction("ShowBookmarks", default_profile); + + if (!profile_->IsOffTheRecord()) { + ShowSingletonTab(GURL(chrome::kChromeUIBookmarksURL)); + } else { + Browser* browser = BrowserList::GetLastActiveWithProfile(default_profile); + if (browser) { + browser->ShowBookmarkManagerTab(); + browser->window()->Activate(); + } else { + OpenBookmarkManagerWindow(default_profile); + } + } } void Browser::ShowHistoryTab() { diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index cff63ee..6ac5f01 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -187,10 +187,12 @@ class Browser : public TabStripModelDelegate, static void OpenApplicationWindow(Profile* profile, const GURL& url, bool as_panel); + // Opens a new window and opens the bookmark manager. + static void OpenBookmarkManagerWindow(Profile* profile); + #if defined(OS_MACOSX) // Open a new window with history/downloads/help (needed on Mac when there are // no windows). - static void OpenBookmarkManagerWindow(Profile* profile); static void OpenHistoryWindow(Profile* profile); static void OpenDownloadsWindow(Profile* profile); static void OpenHelpWindow(Profile* profile); |