Update CrOS OOBE throbber to MD throbber; delete old asset
[chromium-blink-merge.git] / chrome / common / extensions / extension_metrics.cc
blobeef45a4928c7a1e1fa2210dfaee07282aa31d6b2
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.
5 #include "chrome/common/extensions/extension_metrics.h"
7 #include "base/metrics/histogram.h"
8 #include "extensions/common/constants.h"
9 #include "extensions/common/extension.h"
11 namespace extensions {
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);
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());
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());
45 void RecordWebStoreLaunch() {
46 RecordAppLaunchType(extension_misc::APP_LAUNCH_NTP_WEBSTORE,
47 extensions::Manifest::TYPE_HOSTED_APP);
50 } // namespace extensions