diff options
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 7 | ||||
-rw-r--r-- | chrome/browser/dom_ui/shown_sections_handler.cc | 5 |
2 files changed, 8 insertions, 4 deletions
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); } } |