diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-30 04:25:05 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-30 04:25:05 +0000 |
commit | 16f7fba7bced6f0cbca54bdfe911863d9d0acd98 (patch) | |
tree | bc25e64fb54b51ddc357ddd9cddaff6414987550 /chrome | |
parent | f48d4e96e5de24da68e2a755e74b6cae63cd0843 (diff) | |
download | chromium_src-16f7fba7bced6f0cbca54bdfe911863d9d0acd98.zip chromium_src-16f7fba7bced6f0cbca54bdfe911863d9d0acd98.tar.gz chromium_src-16f7fba7bced6f0cbca54bdfe911863d9d0acd98.tar.bz2 |
Unbreak app launch container overriding. Before, you could choose what kind of app container you wanted to launch in so that we could try out different things.
My change to window affinity change broke this for tabs. This should fix it.
Review URL: http://codereview.chromium.org/1811005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46038 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.cc | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 88bae48..7965c48 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -3366,21 +3366,26 @@ bool Browser::HandleCrossAppNavigation(TabContents* source, if (!service) return false; + // Get the source extension, if any. + Extension* source_extension = source->app_extension(); + if (!source_extension) + source_extension = extension_app_; + // Get the destination URL's extension, if any. - Extension* extension = service->GetExtensionByURL(url); - if (!extension) - extension = service->GetExtensionByWebExtent(url); + Extension* destination_extension = service->GetExtensionByURL(url); + if (!destination_extension) + destination_extension = service->GetExtensionByWebExtent(url); - if (extension) { - // If we're navigating to the same extension, do nothing. - if (extension == extension_app_) - return false; + // If they are the same, nothing to do. + if (source_extension == destination_extension) + return false; - // If there's already a window for the destination extension, open the URL - // there. + if (destination_extension) { + // Search for an existing app window for this app. for (BrowserList::const_iterator iter = BrowserList::begin(); iter != BrowserList::end(); ++iter) { - if (extension == (*iter)->extension_app()) { + // Found an app window, open the URL there. + if ((*iter)->extension_app() == destination_extension) { (*iter)->OpenURL(url, referrer, NEW_FOREGROUND_TAB, transition); return true; } @@ -3388,16 +3393,16 @@ bool Browser::HandleCrossAppNavigation(TabContents* source, // If the extension wants to be opened in a window, but there is no // existing window, create one, then open the URL there. - if (extension->launch_container() == Extension::LAUNCH_WINDOW) { - Browser::OpenApplicationWindow(profile_, extension, + if (destination_extension->launch_container() == + Extension::LAUNCH_WINDOW) { + Browser::OpenApplicationWindow(profile_, destination_extension, Extension::LAUNCH_WINDOW, url); return true; } } - // If the current browser is for an extension, then the destination URL must - // not be for that extension (otherwise, we would have caught it above). So - // find a normal browser and open the URL there. + // Otherwise, if this is an app window, we don't want to open the URL here, + // so find a normal browser to open it in. if (extension_app_) { Browser* browser = GetOrCreateTabbedBrowser(profile_); browser->OpenURL(url, referrer, NEW_FOREGROUND_TAB, transition); |