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

Unified Diff: chrome/common/extensions/extension_metrics.cc

Issue 725853002: Move app launch metric recording code from NTP to chrome/common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More mac Created 6 years, 1 month 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/common/extensions/extension_metrics.h ('k') | chrome/renderer/chrome_content_renderer_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension_metrics.cc
diff --git a/chrome/common/extensions/extension_metrics.cc b/chrome/common/extensions/extension_metrics.cc
new file mode 100644
index 0000000000000000000000000000000000000000..eef45a4928c7a1e1fa2210dfaee07282aa31d6b2
--- /dev/null
+++ b/chrome/common/extensions/extension_metrics.cc
@@ -0,0 +1,50 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/extensions/extension_metrics.h"
+
+#include "base/metrics/histogram.h"
+#include "extensions/common/constants.h"
+#include "extensions/common/extension.h"
+
+namespace extensions {
+
+void RecordAppLaunchType(extension_misc::AppLaunchBucket bucket,
+ extensions::Manifest::Type app_type) {
+ DCHECK_LT(bucket, extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ if (app_type == extensions::Manifest::TYPE_PLATFORM_APP) {
+ UMA_HISTOGRAM_ENUMERATION("Apps.AppLaunch", bucket,
+ extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ } else {
+ UMA_HISTOGRAM_ENUMERATION("Extensions.AppLaunch", bucket,
+ extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
+ }
+}
+
+void RecordAppListSearchLaunch(const extensions::Extension* extension) {
+ extension_misc::AppLaunchBucket bucket =
+ extension_misc::APP_LAUNCH_APP_LIST_SEARCH;
+ if (extension->id() == extensions::kWebStoreAppId)
+ bucket = extension_misc::APP_LAUNCH_APP_LIST_SEARCH_WEBSTORE;
+ else if (extension->id() == extension_misc::kChromeAppId)
+ bucket = extension_misc::APP_LAUNCH_APP_LIST_SEARCH_CHROME;
+ RecordAppLaunchType(bucket, extension->GetType());
+}
+
+void RecordAppListMainLaunch(const extensions::Extension* extension) {
+ extension_misc::AppLaunchBucket bucket =
+ extension_misc::APP_LAUNCH_APP_LIST_MAIN;
+ if (extension->id() == extensions::kWebStoreAppId)
+ bucket = extension_misc::APP_LAUNCH_APP_LIST_MAIN_WEBSTORE;
+ else if (extension->id() == extension_misc::kChromeAppId)
+ bucket = extension_misc::APP_LAUNCH_APP_LIST_MAIN_CHROME;
+ RecordAppLaunchType(bucket, extension->GetType());
+}
+
+void RecordWebStoreLaunch() {
+ RecordAppLaunchType(extension_misc::APP_LAUNCH_NTP_WEBSTORE,
+ extensions::Manifest::TYPE_HOSTED_APP);
+}
+
+} // namespace extensions
« no previous file with comments | « chrome/common/extensions/extension_metrics.h ('k') | chrome/renderer/chrome_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698