diff options
author | yutak@chromium.org <yutak@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-01 06:24:04 +0000 |
---|---|---|
committer | yutak@chromium.org <yutak@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-01 06:24:04 +0000 |
commit | de4e763c08d7966d3aa3efca16157ee800a3b2ba (patch) | |
tree | b2efd2b89676e002ba3f4f63f2cc1498fdac0f0c | |
parent | 2d460ee1fc517d8951fb7ba9e6881ad2cc7c716e (diff) | |
download | chromium_src-de4e763c08d7966d3aa3efca16157ee800a3b2ba.zip chromium_src-de4e763c08d7966d3aa3efca16157ee800a3b2ba.tar.gz chromium_src-de4e763c08d7966d3aa3efca16157ee800a3b2ba.tar.bz2 |
Mac: Allowed incognito windows to be bookmark open target.
Patch contributed by Hajime Morita <morrita@google.com>.
Original review URL: http://codereview.chromium.org/3217007
BUG=23547
TEST=manual
Review URL: http://codereview.chromium.org/3225009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58141 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser.cc | 9 | ||||
-rw-r--r-- | chrome/browser/browser.h | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_menu_cocoa_controller.mm | 5 |
3 files changed, 13 insertions, 4 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index eab1ea4..26a7287 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -3746,9 +3746,14 @@ bool Browser::CanCloseWithInProgressDownloads() { // Browser, Assorted utility functions (private): // static +Browser* Browser::GetTabbedBrowser(Profile* profile, bool match_incognito) { + return BrowserList::FindBrowserWithType(profile, TYPE_NORMAL, + match_incognito); +} + +// static Browser* Browser::GetOrCreateTabbedBrowser(Profile* profile) { - Browser* browser = BrowserList::FindBrowserWithType(profile, TYPE_NORMAL, - false); + Browser* browser = GetTabbedBrowser(profile, false); if (!browser) browser = Browser::Create(profile); return browser; diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index 2cfc560f..e2c9c36 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -573,6 +573,9 @@ class Browser : public TabStripModelDelegate, const NavigationController* controller, int* index); // Retrieve the last active tabbed browser with a profile matching |profile|. + static Browser* GetTabbedBrowser(Profile* profile, bool match_incognito); + + // Retrieve the last active tabbed browser with a profile matching |profile|. // Creates a new Browser if none are available. static Browser* GetOrCreateTabbedBrowser(Profile* profile); diff --git a/chrome/browser/cocoa/bookmark_menu_cocoa_controller.mm b/chrome/browser/cocoa/bookmark_menu_cocoa_controller.mm index 6eae73c..898e2f9 100644 --- a/chrome/browser/cocoa/bookmark_menu_cocoa_controller.mm +++ b/chrome/browser/cocoa/bookmark_menu_cocoa_controller.mm @@ -74,8 +74,9 @@ const NSUInteger kMaximumMenuPixelsWide = 300; // Open the URL of the given BookmarkNode in the current tab. - (void)openURLForNode:(const BookmarkNode*)node { - Browser* browser = - Browser::GetOrCreateTabbedBrowser(bridge_->GetProfile()); + Browser* browser = Browser::GetTabbedBrowser(bridge_->GetProfile(), true); + if (!browser) + browser = Browser::Create(bridge_->GetProfile()); WindowOpenDisposition disposition = event_utils::WindowOpenDispositionFromNSEvent([NSApp currentEvent]); browser->OpenURL(node->GetURL(), GURL(), disposition, |