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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/common/extensions/extension_metrics.h"
6
7 #include "base/metrics/histogram.h"
8 #include "extensions/common/constants.h"
9 #include "extensions/common/extension.h"
10
11 namespace extensions {
12
13 void RecordAppLaunchType(extension_misc::AppLaunchBucket bucket,
14 extensions::Manifest::Type app_type) {
15 DCHECK_LT(bucket, extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
16 if (app_type == extensions::Manifest::TYPE_PLATFORM_APP) {
17 UMA_HISTOGRAM_ENUMERATION("Apps.AppLaunch", bucket,
18 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
19 } else {
20 UMA_HISTOGRAM_ENUMERATION("Extensions.AppLaunch", bucket,
21 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
22 }
23 }
24
25 void RecordAppListSearchLaunch(const extensions::Extension* extension) {
26 extension_misc::AppLaunchBucket bucket =
27 extension_misc::APP_LAUNCH_APP_LIST_SEARCH;
28 if (extension->id() == extensions::kWebStoreAppId)
29 bucket = extension_misc::APP_LAUNCH_APP_LIST_SEARCH_WEBSTORE;
30 else if (extension->id() == extension_misc::kChromeAppId)
31 bucket = extension_misc::APP_LAUNCH_APP_LIST_SEARCH_CHROME;
32 RecordAppLaunchType(bucket, extension->GetType());
33 }
34
35 void RecordAppListMainLaunch(const extensions::Extension* extension) {
36 extension_misc::AppLaunchBucket bucket =
37 extension_misc::APP_LAUNCH_APP_LIST_MAIN;
38 if (extension->id() == extensions::kWebStoreAppId)
39 bucket = extension_misc::APP_LAUNCH_APP_LIST_MAIN_WEBSTORE;
40 else if (extension->id() == extension_misc::kChromeAppId)
41 bucket = extension_misc::APP_LAUNCH_APP_LIST_MAIN_CHROME;
42 RecordAppLaunchType(bucket, extension->GetType());
43 }
44
45 void RecordWebStoreLaunch() {
46 RecordAppLaunchType(extension_misc::APP_LAUNCH_NTP_WEBSTORE,
47 extensions::Manifest::TYPE_HOSTED_APP);
48 }
49
50 } // namespace extensions
OLDNEW
« 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