diff options
author | andybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-30 02:03:49 +0000 |
---|---|---|
committer | andybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-30 02:03:49 +0000 |
commit | 10abd198e989f003f5f2fcaad735bf3566a5f8ba (patch) | |
tree | c123193e87d254fc8a63526bcce584ea39569f87 /chrome/browser/browser.cc | |
parent | ff7321db2060aa69b63b2090b0e5eb92d2df704e (diff) | |
download | chromium_src-10abd198e989f003f5f2fcaad735bf3566a5f8ba.zip chromium_src-10abd198e989f003f5f2fcaad735bf3566a5f8ba.tar.gz chromium_src-10abd198e989f003f5f2fcaad735bf3566a5f8ba.tar.bz2 |
o Add user customizable launch type for apps by adding options in each apps context menu.
o Updated some comments that were using the outdated NOTIFY_PREF_CHANGED notification.
o Make LAUNCH_PINNED the default type returned by ExtensionPrefs if it does not already exist.
o Some minor refactoring within the code to reduce duplication.
BUG=54731
TEST=NONE
patch from issue 3419010
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=60997
Reverted: http://crrev.com/61000
Review URL: http://codereview.chromium.org/3453029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61021 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r-- | chrome/browser/browser.cc | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 1d2c82f..13bfbc1 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -47,6 +47,7 @@ #include "chrome/browser/extensions/extension_browser_event_router.h" #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" #include "chrome/browser/extensions/extension_host.h" +#include "chrome/browser/extensions/extension_prefs.h" #include "chrome/browser/extensions/extension_tabs_module.h" #include "chrome/browser/extensions/extensions_service.h" #include "chrome/browser/find_bar.h" @@ -556,16 +557,28 @@ TabContents* Browser::OpenApplicationTab(Profile* profile, Extension* extension, Browser** browser) { Browser* local_browser = BrowserList::GetLastActiveWithProfile(profile); + TabContents* tab_contents = NULL; if (!local_browser || local_browser->type() != Browser::TYPE_NORMAL) - return NULL; + return tab_contents; + + // Check the prefs for overridden mode. + ExtensionsService* extensions_service = profile->GetExtensionsService(); + DCHECK(extensions_service); - // TODO(erikkay): This doesn't seem like the right transition in all cases. - PageTransition::Type transition = PageTransition::START_PAGE; + ExtensionPrefs::LaunchType launch_type = + extensions_service->extension_prefs()->GetLaunchType(extension->id()); + int add_type = TabStripModel::ADD_SELECTED; + if (launch_type == ExtensionPrefs::LAUNCH_PINNED) + add_type |= TabStripModel::ADD_PINNED; - return local_browser->AddTabWithURL( - extension->GetFullLaunchURL(), GURL(), transition, -1, - TabStripModel::ADD_PINNED | TabStripModel::ADD_SELECTED, - NULL, "", browser); + // TODO(erikkay): START_PAGE doesn't seem like the right transition in all + // cases. + tab_contents = local_browser->AddTabWithURL(extension->GetFullLaunchURL(), + GURL(), PageTransition::START_PAGE, -1, add_type, NULL, "", browser); + if (launch_type == ExtensionPrefs::LAUNCH_FULLSCREEN) + local_browser->window()->SetFullscreen(true); + + return tab_contents; } // static |