OLD | NEW |
---|---|
(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 enum ManifestFetchResultType { | |
Mark P
2014/10/03 19:57:49
Please put the standard warning here that this enu
mlamouri (slow - plz ping)
2014/10/07 11:11:39
Done.
| |
15 MANIFEST_FETCH_SUCCESS = 0, | |
16 MANIFEST_FETCH_ERROR_EMPTY_URL, | |
17 MANIFEST_FETCH_ERROR_UNSPECIFIED, | |
18 MANIFEST_FETCH_RESULT_TYPE_COUNT | |
19 }; | |
20 | |
21 } // anonymous namespace | |
22 | |
23 void ManifestUmaUtil::ParseSucceeded(const Manifest& manifest) { | |
24 UMA_HISTOGRAM_BOOLEAN("Manifest.ParseSuccess", true); | |
25 UMA_HISTOGRAM_BOOLEAN("Manifest.IsEmpty", manifest.IsEmpty()); | |
26 if (manifest.IsEmpty()) | |
27 return; | |
28 | |
29 UMA_HISTOGRAM_BOOLEAN("Manifest.name", !manifest.name.is_null()); | |
30 UMA_HISTOGRAM_BOOLEAN("Manifest.short_name", !manifest.short_name.is_null()); | |
31 UMA_HISTOGRAM_BOOLEAN("Manifest.start_url", !manifest.start_url.is_empty()); | |
32 UMA_HISTOGRAM_BOOLEAN("Manifest.display", | |
33 manifest.display != Manifest::DISPLAY_MODE_UNSPECIFIED); | |
34 UMA_HISTOGRAM_BOOLEAN("Manifest.orientation", | |
35 manifest.orientation != blink::WebScreenOrientationLockDefault); | |
36 UMA_HISTOGRAM_BOOLEAN("Manifest.icons", !manifest.icons.empty()); | |
37 UMA_HISTOGRAM_BOOLEAN("Manifest.gcm_sender_id", | |
38 !manifest.gcm_sender_id.is_null()); | |
39 } | |
40 | |
41 void ManifestUmaUtil::ParseFailed() { | |
42 UMA_HISTOGRAM_BOOLEAN("Manifest.ParseSuccess", false); | |
Mark P
2014/10/03 19:57:49
You use this name in two places. Consider making
mlamouri (slow - plz ping)
2014/10/07 11:11:39
Done.
| |
43 } | |
44 | |
45 void ManifestUmaUtil::FetchSucceeded() { | |
46 UMA_HISTOGRAM_ENUMERATION("Manifest.FetchResult", | |
Mark P
2014/10/03 19:57:49
ditto for this histogram name.
mlamouri (slow - plz ping)
2014/10/07 11:11:38
Done.
| |
47 MANIFEST_FETCH_SUCCESS, | |
48 MANIFEST_FETCH_RESULT_TYPE_COUNT); | |
49 } | |
50 | |
51 void ManifestUmaUtil::FetchFailed(FetchFailureReason reason) { | |
52 ManifestFetchResultType fetch_result_type = MANIFEST_FETCH_RESULT_TYPE_COUNT; | |
53 switch (reason) { | |
54 case FETCH_EMPTY_URL: | |
55 fetch_result_type = MANIFEST_FETCH_ERROR_EMPTY_URL; | |
Miguel Garcia
2014/10/02 15:56:42
why do you want two enums? one for uma and one ext
mlamouri (slow - plz ping)
2014/10/02 16:10:55
One enum is the UMA enum, it's an implementation d
| |
56 break; | |
57 case FETCH_UNSPECIFIED_REASON: | |
58 fetch_result_type = MANIFEST_FETCH_ERROR_UNSPECIFIED; | |
59 break; | |
60 } | |
61 DCHECK_NE(fetch_result_type, MANIFEST_FETCH_RESULT_TYPE_COUNT); | |
62 | |
63 UMA_HISTOGRAM_ENUMERATION("Manifest.FetchResult", | |
64 fetch_result_type, | |
65 MANIFEST_FETCH_RESULT_TYPE_COUNT); | |
66 } | |
67 | |
68 } // namespace content | |
OLD | NEW |