Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1070)

Unified Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 2012993002: Remove the app launcher promo code Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 4521713224cc7852db281c9936f57b05bb21cac7..630bb748a8205e3874823aeaaf271c6a45c69d39 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -8,7 +8,6 @@
#include <vector>
-#include "apps/metrics_names.h"
#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -27,7 +26,6 @@
#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/app_list/app_list_util.h"
#include "chrome/browser/ui/apps/app_info_dialog.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_finder.h"
@@ -91,12 +89,10 @@ enum {
APPS_PAGE_ID = 2 << kPageIdOffset,
};
-void RecordAppLauncherPromoHistogram(
- apps::AppLauncherPromoHistogramValues value) {
- DCHECK_LT(value, apps::APP_LAUNCHER_PROMO_MAX);
- UMA_HISTOGRAM_ENUMERATION(
- "Apps.AppLauncherPromo", value, apps::APP_LAUNCHER_PROMO_MAX);
-}
+// This is used to avoid a DCHECK due to an unhandled WebUI callback. The
+// JavaScript used to switch between pages sends "pageSelected" which is used
+// in the context of the NTP for recording metrics we don't need here.
+void NoOpCallback(const base::ListValue* args) {}
} // namespace
@@ -109,10 +105,6 @@ AppLauncherHandler::AppLauncherHandler(ExtensionService* extension_service)
ignore_changes_(false),
attempted_bookmark_app_install_(false),
has_loaded_apps_(false) {
- if (IsAppLauncherEnabled())
- RecordAppLauncherPromoHistogram(apps::APP_LAUNCHER_PROMO_ALREADY_INSTALLED);
- else if (ShouldShowAppLauncherPromo())
- RecordAppLauncherPromoHistogram(apps::APP_LAUNCHER_PROMO_SHOWN);
}
AppLauncherHandler::~AppLauncherHandler() {
@@ -231,16 +223,6 @@ void AppLauncherHandler::RegisterMessages() {
registrar_.Add(this, chrome::NOTIFICATION_APP_INSTALLED_TO_NTP,
content::Source<WebContents>(web_ui()->GetWebContents()));
- // Some tests don't have a local state.
-#if defined(ENABLE_APP_LIST)
- if (g_browser_process->local_state()) {
- local_state_pref_change_registrar_.Init(g_browser_process->local_state());
- local_state_pref_change_registrar_.Add(
- prefs::kShowAppLauncherPromo,
- base::Bind(&AppLauncherHandler::OnLocalStatePreferenceChanged,
- base::Unretained(this)));
- }
-#endif
web_ui()->RegisterMessageCallback("getApps",
base::Bind(&AppLauncherHandler::HandleGetApps,
base::Unretained(this)));
@@ -271,15 +253,7 @@ void AppLauncherHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("generateAppForLink",
base::Bind(&AppLauncherHandler::HandleGenerateAppForLink,
base::Unretained(this)));
- web_ui()->RegisterMessageCallback("stopShowingAppLauncherPromo",
- base::Bind(&AppLauncherHandler::HandleStopShowingAppLauncherPromo,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback("onLearnMore",
- base::Bind(&AppLauncherHandler::HandleOnLearnMore,
- base::Unretained(this)));
- web_ui()->RegisterMessageCallback("pageSelected",
- base::Bind(&AppLauncherHandler::HandlePageSelected,
- base::Unretained(this)));
+ web_ui()->RegisterMessageCallback("pageSelected", base::Bind(&NoOpCallback));
}
void AppLauncherHandler::Observe(int type,
@@ -734,19 +708,6 @@ void AppLauncherHandler::HandleGenerateAppForLink(const base::ListValue* args) {
&cancelable_task_tracker_);
}
-void AppLauncherHandler::HandleStopShowingAppLauncherPromo(
- const base::ListValue* args) {
-#if defined(ENABLE_APP_LIST)
- g_browser_process->local_state()->SetBoolean(
- prefs::kShowAppLauncherPromo, false);
- RecordAppLauncherPromoHistogram(apps::APP_LAUNCHER_PROMO_DISMISSED);
-#endif
-}
-
-void AppLauncherHandler::HandleOnLearnMore(const base::ListValue* args) {
- RecordAppLauncherPromoHistogram(apps::APP_LAUNCHER_PROMO_LEARN_MORE);
-}
-
void AppLauncherHandler::HandlePageSelected(const base::ListValue* args) {
double index_double;
CHECK(args->GetDouble(0, &index_double));
@@ -794,15 +755,6 @@ void AppLauncherHandler::OnExtensionPreferenceChanged() {
web_ui()->CallJavascriptFunction("ntp.appsPrefChangeCallback", dictionary);
}
-void AppLauncherHandler::OnLocalStatePreferenceChanged() {
-#if defined(ENABLE_APP_LIST)
- web_ui()->CallJavascriptFunction(
- "ntp.appLauncherPromoPrefChangeCallback",
- base::FundamentalValue(g_browser_process->local_state()->GetBoolean(
- prefs::kShowAppLauncherPromo)));
-#endif
-}
-
void AppLauncherHandler::CleanupAfterUninstall() {
extension_id_prompting_.clear();
}
« no previous file with comments | « chrome/browser/ui/webui/ntp/app_launcher_handler.h ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698