Index: chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
index 43cd98b2fd5e34090e7af13a4edb74b7990e861c..12bc742a47e7279cb5f9642097b6e3a98ea449eb 100644 |
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc |
@@ -9,7 +9,6 @@ |
#include "base/auto_reset.h" |
#include "base/callback.h" |
-#include "base/command_line.h" |
#include "base/metrics/histogram.h" |
#include "base/string_number_conversions.h" |
#include "base/string_split.h" |
@@ -28,9 +27,9 @@ |
#include "chrome/browser/ui/browser_list.h" |
#include "chrome/browser/ui/browser_window.h" |
#include "chrome/browser/ui/webui/extension_icon_source.h" |
+#include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
#include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" |
#include "chrome/common/chrome_notification_types.h" |
-#include "chrome/common/chrome_switches.h" |
#include "chrome/common/extensions/extension.h" |
#include "chrome/common/extensions/extension_constants.h" |
#include "chrome/common/extensions/extension_icon_set.h" |
@@ -101,7 +100,7 @@ bool AppLauncherHandler::IsAppExcludedFromList(const Extension* extension) { |
// The WebStore launcher gets special treatment in ntp/apps.js. |
// The Cloud Print app should never be displayed in the NTP. |
bool ntp3 = |
- !CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4); |
+ !NewTabUI::Ntp4Enabled(); |
if (!extension->is_app() || |
(ntp3 && extension->id() == extension_misc::kWebStoreAppId) || |
(extension->id() == extension_misc::kCloudPrintAppId)) { |
@@ -267,7 +266,7 @@ void AppLauncherHandler::Observe(int type, |
if (!extension->is_app()) |
break; |
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4)) { |
+ if (NewTabUI::Ntp4Enabled()) { |
scoped_ptr<DictionaryValue> app_info(GetAppInfo(extension)); |
if (app_info.get()) { |
std::string function = |
@@ -365,7 +364,7 @@ void AppLauncherHandler::FillAppDictionary(DictionaryValue* dictionary) { |
extension_service_->apps_promo()->ShouldShowAppLauncher( |
extension_service_->GetAppIds())); |
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4)) { |
+ if (NewTabUI::Ntp4Enabled()) { |
PrefService* prefs = web_ui_->GetProfile()->GetPrefs(); |
const ListValue* app_page_names = prefs->GetList(prefs::kNTPAppPageNames); |
if (app_page_names && app_page_names->GetSize()) { |
@@ -499,8 +498,7 @@ void AppLauncherHandler::HandleLaunchApp(const ListValue* args) { |
if (extension_id != extension_misc::kWebStoreAppId) { |
RecordAppLaunchByID(promo_active_, launch_bucket); |
extension_service_->apps_promo()->ExpireDefaultApps(); |
- } else if (CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kNewTabPage4)) { |
+ } else if (NewTabUI::Ntp4Enabled()) { |
RecordWebStoreLaunch(promo_active_); |
} |
@@ -548,7 +546,7 @@ void AppLauncherHandler::HandleSetLaunchType(const ListValue* args) { |
// Don't update the page; it already knows about the launch type change. |
scoped_ptr<AutoReset<bool> > auto_reset; |
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4)) |
+ if (NewTabUI::Ntp4Enabled()) |
auto_reset.reset(new AutoReset<bool>(&ignore_changes_, true)); |
extension_service_->extension_prefs()->SetLaunchType( |
@@ -579,7 +577,7 @@ void AppLauncherHandler::HandleUninstallApp(const ListValue* args) { |
bool dont_confirm = false; |
if (args->GetBoolean(1, &dont_confirm) && dont_confirm) { |
scoped_ptr<AutoReset<bool> > auto_reset; |
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4)) |
+ if (NewTabUI::Ntp4Enabled()) |
auto_reset.reset(new AutoReset<bool>(&ignore_changes_, true)); |
ExtensionDialogAccepted(); |
} else { |
@@ -591,7 +589,7 @@ void AppLauncherHandler::HandleHideAppsPromo(const ListValue* args) { |
// If the user has intentionally hidden the promotion, we'll uninstall all the |
// default apps (we know the user hasn't installed any apps on their own at |
// this point, or the promotion wouldn't have been shown). |
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4)) { |
+ if (NewTabUI::Ntp4Enabled()) { |
UninstallDefaultApps(); |
extension_service_->apps_promo()->HidePromo(); |
} else { |
@@ -642,7 +640,7 @@ void AppLauncherHandler::HandleReorderApps(const ListValue* args) { |
// Don't update the page; it already knows the apps have been reordered. |
scoped_ptr<AutoReset<bool> > auto_reset; |
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4)) |
+ if (NewTabUI::Ntp4Enabled()) |
auto_reset.reset(new AutoReset<bool>(&ignore_changes_, true)); |
extension_service_->extension_prefs()->SetAppDraggedByUser(dragged_app_id); |
@@ -657,7 +655,7 @@ void AppLauncherHandler::HandleSetPageIndex(const ListValue* args) { |
// Don't update the page; it already knows the apps have been reordered. |
scoped_ptr<AutoReset<bool> > auto_reset; |
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4)) |
+ if (NewTabUI::Ntp4Enabled()) |
auto_reset.reset(new AutoReset<bool>(&ignore_changes_, true)); |
extension_service_->extension_prefs()->SetPageIndex(extension_id, |