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

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

Issue 9254023: [NTP4] Track the position of each app that's launched. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: off by 2 error Created 8 years, 11 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
« no previous file with comments | « chrome/browser/ui/webui/ntp/app_launcher_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ef81c8e661ee337a839a066919c4764981c092f1..04ac81522435205a1e45db7f2a84b871ce72a6d1 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -68,6 +68,11 @@ extension_misc::AppLaunchBucket ParseLaunchSource(
return bucket;
}
+enum {
+ APP_LAUNCHED_FROM_INDEX_WIDE_OFFSET = 100,
+ APP_LAUNCHED_FROM_INDEX_BOUNDARY = 200,
+};
+
} // namespace
AppLauncherHandler::AppInstallInfo::AppInstallInfo() {}
@@ -235,6 +240,9 @@ void AppLauncherHandler::RegisterMessages() {
web_ui()->RegisterMessageCallback("recordAppLaunchByURL",
base::Bind(&AppLauncherHandler::HandleRecordAppLaunchByURL,
base::Unretained(this)));
+ web_ui()->RegisterMessageCallback("recordAppLaunchedFromIndex",
+ base::Bind(&AppLauncherHandler::HandleRecordAppLaunchedFromIndex,
+ base::Unretained(this)));
web_ui()->RegisterMessageCallback("closeNotification",
base::Bind(&AppLauncherHandler::HandleNotificationClose,
base::Unretained(this)));
@@ -769,6 +777,24 @@ void AppLauncherHandler::HandleRecordAppLaunchByURL(
RecordAppLaunchByURL(Profile::FromWebUI(web_ui()), url, bucket);
}
+void AppLauncherHandler::HandleRecordAppLaunchedFromIndex(
+ const base::ListValue* args) {
+ double index_double;
+ CHECK(args->GetDouble(0, &index_double));
+ bool wide;
+ CHECK(args->GetBoolean(1, &wide));
+
+ // +1 to make it a natural (i.e. 1,2,3 instead of 0,1,2).
+ size_t index = static_cast<size_t>(index_double) + 1;
+ if (wide)
+ index += APP_LAUNCHED_FROM_INDEX_WIDE_OFFSET;
+ else if (index >= APP_LAUNCHED_FROM_INDEX_WIDE_OFFSET + 1)
+ index = APP_LAUNCHED_FROM_INDEX_BOUNDARY + 1;
+
+ UMA_HISTOGRAM_ENUMERATION("NewTabPage.AppLaunchedFromIndex", index,
+ APP_LAUNCHED_FROM_INDEX_BOUNDARY);
+}
+
void AppLauncherHandler::HandleNotificationClose(const ListValue* args) {
std::string extension_id;
CHECK(args->GetString(0, &extension_id));
« no previous file with comments | « chrome/browser/ui/webui/ntp/app_launcher_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698