diff options
author | skerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-24 16:33:03 +0000 |
---|---|---|
committer | skerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-24 16:33:03 +0000 |
commit | 61a57ce8f5687d1d7e9ef8e39af14773c135a144 (patch) | |
tree | 2e074ed9f2603783ca4363fe1ed63ee25d8da5de /chrome/browser/browser.cc | |
parent | d3d9b4fb5b36702006f903e2d1ed0aa7e9829d64 (diff) | |
download | chromium_src-61a57ce8f5687d1d7e9ef8e39af14773c135a144.zip chromium_src-61a57ce8f5687d1d7e9ef8e39af14773c135a144.tar.gz chromium_src-61a57ce8f5687d1d7e9ef8e39af14773c135a144.tar.bz2 |
Make app panels use popup type. Nuke refocus code and tests.
BUG=55943
TEST=Manual.
Review URL: http://codereview.chromium.org/3418027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 68 |
1 files changed, 8 insertions, 60 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index d596ec4c..dea3cb9 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -338,8 +338,12 @@ Browser* Browser::CreateForApp(const std::string& app_name, bool is_panel) { Browser::Type type = TYPE_APP; - if (is_panel) - type = TYPE_APP_PANEL; + if (is_panel) { + // TYPE_APP_PANEL is the logical choice. However, the panel UI + // is not fully implemented. See crbug/55943. + type = TYPE_APP_POPUP; + } + else if (extension) type = TYPE_EXTENSION_APP; @@ -468,43 +472,6 @@ void Browser::OpenURLOffTheRecord(Profile* profile, const GURL& url) { } // static -Browser* Browser::FindAppWindowOrPanel(Profile* profile, - Extension* extension_app) { - // Test the focused browser first. - Browser* browser = BrowserList::GetLastActive(); - if (browser && BrowserHostsExtensionApp(browser, profile, extension_app)) - return browser; - - BrowserList::const_iterator browser_all; - for (browser_all = BrowserList::begin(); - browser_all != BrowserList::end(); - ++browser_all) { - if (BrowserHostsExtensionApp(*browser_all, profile, extension_app)) - return *browser_all; - } - return NULL; -} - -// static -TabContents* Browser::FindAppTab(Browser* browser, Extension* extension_app) { - if (browser->type() != Browser::TYPE_NORMAL) - return NULL; - - for (int tab_idx = 0; tab_idx < browser->tab_count(); ++tab_idx) { - TabContents* tab_contents = browser->GetTabContentsAt(tab_idx); - if (!tab_contents) - continue; - - if (tab_contents->extension_app() != extension_app) - continue; - - return tab_contents; - } - - return NULL; -} - -// static // TODO(erikkay): There are multiple reasons why this could fail. Should // this function return an error reason as well so that callers can show // reasonable errors? @@ -530,34 +497,15 @@ TabContents* Browser::OpenApplication( extension_misc::LaunchContainer container) { TabContents* tab = NULL; - // If the app is loaded in an existing window or panel, focus it. - Browser* browser = FindAppWindowOrPanel(profile, extension); - if (browser) { - browser->window()->Show(); - return browser->GetSelectedTabContents(); - } - - // If an app is loaded in an app tab in the focused browser, select it. - browser = BrowserList::GetLastActive(); - if (browser && browser->profile() == profile) { - tab = Browser::FindAppTab(browser, extension); - if (tab) { - int tab_idx = browser->tabstrip_model()->GetIndexOfTabContents(tab); - DCHECK(tab_idx != TabStripModel::kNoTab); - browser->SelectTabContentsAt(tab_idx, false); - return tab; - } - } - // The app is not yet open. Load it. switch (container) { case extension_misc::LAUNCH_WINDOW: case extension_misc::LAUNCH_PANEL: tab = Browser::OpenApplicationWindow(profile, extension, container, - GURL(), &browser); + GURL(), NULL); break; case extension_misc::LAUNCH_TAB: { - tab = Browser::OpenApplicationTab(profile, extension, &browser); + tab = Browser::OpenApplicationTab(profile, extension, NULL); break; } default: |