diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser.cc | 27 | ||||
-rw-r--r-- | chrome/browser/defaults.cc | 2 | ||||
-rw-r--r-- | chrome/browser/defaults.h | 3 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 7 | ||||
-rw-r--r-- | chrome/browser/dom_ui/shown_sections_handler.cc | 5 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_install_ui.cc | 9 | ||||
-rw-r--r-- | chrome/browser/profile.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_bar_view.cc | 7 |
8 files changed, 17 insertions, 45 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index b723a85c..68d14ca 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1052,15 +1052,11 @@ void Browser::UpdateCommandsForFullscreenMode(bool is_fullscreen) { bool Browser::OpenAppsPanelAsNewTab() { #if defined(OS_CHROMEOS) || defined(OS_WIN) CommandLine* command_line = CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(switches::kDisableAppsPanel) || - (!browser_defaults::kShowAppsPanelForNewTab && - !command_line->HasSwitch(switches::kAppsPanel))) { - return false; + if (command_line->HasSwitch(switches::kAppsPanel)) { + AppLauncher::ShowForNewTab(this, std::string()); + return true; } - AppLauncher::ShowForNewTab(this, std::string()); - return true; -#endif // OS_CHROMEOS || OS_WIN - +#endif return false; } @@ -2082,21 +2078,6 @@ void Browser::ExecuteCommand(int id) { // Browser, TabStripModelDelegate implementation: TabContents* Browser::AddBlankTab(bool foreground) { - // To make a more "launchy" experience, try to reuse an existing NTP if there - // is one. - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps)) { - for (int i = tabstrip_model_.count() - 1; i >= 0; --i) { - TabContents* contents = tabstrip_model_.GetTabContentsAt(i); - if (StartsWithASCII(contents->GetURL().spec(), - chrome::kChromeUINewTabURL, true)) { - if (foreground) - SelectTabContentsAt(i, true); - - return contents; - } - } - } - return AddBlankTabAt(-1, foreground); } diff --git a/chrome/browser/defaults.cc b/chrome/browser/defaults.cc index ca50e70..a669305 100644 --- a/chrome/browser/defaults.cc +++ b/chrome/browser/defaults.cc @@ -25,7 +25,6 @@ const bool kDownloadPageHasShowInFolder = false; const bool kSizeTabButtonToTopOfTabStrip = true; const bool kBootstrapSyncAuthentication = true; const bool kShowOtherBrowsersInAboutMemory = false; -const bool kShowAppsPanelForNewTab = true; #elif defined(TOOLKIT_USES_GTK) @@ -66,7 +65,6 @@ const bool kOSSupportsOtherBrowsers = true; const bool kSizeTabButtonToTopOfTabStrip = false; const bool kBootstrapSyncAuthentication = false; const bool kShowOtherBrowsersInAboutMemory = true; -const bool kShowAppsPanelForNewTab = false; #endif #if defined(OS_MACOSX) diff --git a/chrome/browser/defaults.h b/chrome/browser/defaults.h index 8a2b543..11dee1f 100644 --- a/chrome/browser/defaults.h +++ b/chrome/browser/defaults.h @@ -67,9 +67,6 @@ extern const bool kBootstrapSyncAuthentication; // Should other browsers be shown in about:memory page? extern const bool kShowOtherBrowsersInAboutMemory; -// Should we show the app panel when a new tab is created? -extern const bool kShowAppsPanelForNewTab; - } // namespace browser_defaults #endif // CHROME_BROWSER_DEFAULTS_H_ diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index 693618e..b605522 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -505,9 +505,12 @@ NewTabUI::NewTabUI(TabContents* contents) if (ProfileSyncService::IsSyncEnabled()) { AddMessageHandler((new NewTabPageSyncHandler())->Attach(this)); } - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps)) { + if (Extension::AppsAreEnabled()) { ExtensionsService* service = GetProfile()->GetExtensionsService(); - AddMessageHandler((new AppLauncherHandler(service))->Attach(this)); + // We might not have an ExtensionsService (on ChromeOS when not logged in + // for example). + if (service) + AddMessageHandler((new AppLauncherHandler(service))->Attach(this)); } AddMessageHandler((new NewTabPageSetHomePageHandler())->Attach(this)); diff --git a/chrome/browser/dom_ui/shown_sections_handler.cc b/chrome/browser/dom_ui/shown_sections_handler.cc index 501c1d8..ecc8f1b 100644 --- a/chrome/browser/dom_ui/shown_sections_handler.cc +++ b/chrome/browser/dom_ui/shown_sections_handler.cc @@ -12,6 +12,7 @@ #include "chrome/browser/pref_service.h" #include "chrome/browser/profile.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" namespace { @@ -87,7 +88,7 @@ void ShownSectionsHandler::SetFirstAppLauncherRunPref( // If we have turned on Apps we want to hide most visited and recent to give // more focus to the Apps section. We do not do this in MigrateUserPrefs // because the pref version should not depend on command line switches. - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps) && + if (Extension::AppsAreEnabled() && !pref_service->GetBoolean(prefs::kNTPAppLauncherFirstRun)) { int sections = pref_service->GetInteger(prefs::kNTPShownSections); sections &= ~THUMB; @@ -101,7 +102,7 @@ void ShownSectionsHandler::SetFirstAppLauncherRunPref( void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) { pref_service->RegisterIntegerPref(prefs::kNTPShownSections, THUMB | RECENT | TIPS | SYNC); - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps)) { + if (Extension::AppsAreEnabled()) { pref_service->RegisterBooleanPref(prefs::kNTPAppLauncherFirstRun, false); } } diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index c85b254..552e231 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -273,13 +273,8 @@ void ExtensionInstallUI::OnImageLoaded( switch (prompt_type_) { case INSTALL_PROMPT: { - if (extension_->GetFullLaunchURL().is_valid()) { - // Special case extension apps to not show the install dialog. - // TODO(finnur): http://crbug.com/42443: Don't do this for all apps. - delegate_->InstallUIProceed(false); // |create_app_shortcut|. - return; - } - + // TODO(jcivelli): http://crbug.com/44771 We should not show an install + // dialog when installing an app from the gallery. NotificationService* service = NotificationService::current(); service->Notify(NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, Source<ExtensionInstallUI>(this), diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index 505a528..eeeee11 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -766,7 +766,7 @@ void ProfileImpl::InitExtensions() { // Some sample apps to make our lives easier while we are developing extension // apps. This way we don't have to constantly install these over and over. - if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableApps)) { + if (Extension::AppsAreEnabled()) { #if defined(OS_WIN) std::string user_domain; if (base::EnvVarGetter::Create()->GetEnv("USERDOMAIN", &user_domain) && diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 8ff3c42..56f2f79 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -33,7 +33,6 @@ #include "chrome/browser/views/event_utils.h" #include "chrome/browser/views/frame/browser_view.h" #include "chrome/browser/views/location_bar/location_bar_view.h" -#include "chrome/common/chrome_switches.h" #include "chrome/common/notification_service.h" #include "chrome/common/page_transition_types.h" #include "chrome/common/pref_names.h" @@ -461,10 +460,8 @@ void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) { gfx::Size BookmarkBarView::GetPreferredSize() { // We don't want the bookmark bar view in the app launcher new tab page. - static bool extension_apps = CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableApps); - bool hide_bookmark_bar = (extension_apps && OnNewTabPage()) || - OnAppsPage(); + bool hide_bookmark_bar = + (Extension::AppsAreEnabled() && OnNewTabPage()) || OnAppsPage(); if (!hide_bookmark_bar) return LayoutItems(true); |