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

Side by Side Diff: content/renderer/manifest/manifest_uma_util.cc

Issue 622813002: [Manifest] Add metrics recording. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screen_orientation_usage_count
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « content/renderer/manifest/manifest_uma_util.h ('k') | tools/metrics/actions/actions.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/renderer/manifest/manifest_uma_util.h"
6
7 #include "base/metrics/histogram.h"
8 #include "content/public/common/manifest.h"
9
10 namespace content {
11
12 namespace {
13
14 static const char kUMANameParseSuccess[] = "Manifest.ParseSuccess";
15 static const char kUMANameFetchResult[] = "Manifest.FetchResult";
16
17 // Enum for UMA purposes, make sure you update histograms.xml if you add new
18 // result types. Never delete or reorder an entry; only add new entries
19 // immediately before MANIFEST_FETCH_RESULT_TYPE_COUNT.
20 enum ManifestFetchResultType {
21 MANIFEST_FETCH_SUCCESS = 0,
22 MANIFEST_FETCH_ERROR_EMPTY_URL = 1,
23 MANIFEST_FETCH_ERROR_UNSPECIFIED = 2,
24
25 // Must stay at the end.
26 MANIFEST_FETCH_RESULT_TYPE_COUNT
27 };
28
29 } // anonymous namespace
30
31 void ManifestUmaUtil::ParseSucceeded(const Manifest& manifest) {
32 UMA_HISTOGRAM_BOOLEAN(kUMANameParseSuccess, true);
33 UMA_HISTOGRAM_BOOLEAN("Manifest.IsEmpty", manifest.IsEmpty());
34 if (manifest.IsEmpty())
35 return;
36
37 UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.name", !manifest.name.is_null());
38 UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.short_name",
39 !manifest.short_name.is_null());
40 UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.start_url",
41 !manifest.start_url.is_empty());
42 UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.display",
43 manifest.display != Manifest::DISPLAY_MODE_UNSPECIFIED);
44 UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.orientation",
45 manifest.orientation != blink::WebScreenOrientationLockDefault);
46 UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.icons", !manifest.icons.empty());
47 UMA_HISTOGRAM_BOOLEAN("Manifest.HasProperty.gcm_sender_id",
48 !manifest.gcm_sender_id.is_null());
49 }
50
51 void ManifestUmaUtil::ParseFailed() {
52 UMA_HISTOGRAM_BOOLEAN(kUMANameParseSuccess, false);
53 }
54
55 void ManifestUmaUtil::FetchSucceeded() {
56 UMA_HISTOGRAM_ENUMERATION(kUMANameFetchResult,
57 MANIFEST_FETCH_SUCCESS,
58 MANIFEST_FETCH_RESULT_TYPE_COUNT);
59 }
60
61 void ManifestUmaUtil::FetchFailed(FetchFailureReason reason) {
62 ManifestFetchResultType fetch_result_type = MANIFEST_FETCH_RESULT_TYPE_COUNT;
63 switch (reason) {
64 case FETCH_EMPTY_URL:
65 fetch_result_type = MANIFEST_FETCH_ERROR_EMPTY_URL;
66 break;
67 case FETCH_UNSPECIFIED_REASON:
68 fetch_result_type = MANIFEST_FETCH_ERROR_UNSPECIFIED;
69 break;
70 }
71 DCHECK_NE(fetch_result_type, MANIFEST_FETCH_RESULT_TYPE_COUNT);
72
73 UMA_HISTOGRAM_ENUMERATION(kUMANameFetchResult,
74 fetch_result_type,
75 MANIFEST_FETCH_RESULT_TYPE_COUNT);
76 }
77
78 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/manifest/manifest_uma_util.h ('k') | tools/metrics/actions/actions.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698