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

Side by Side Diff: components/navigation_metrics/navigation_metrics.cc

Issue 2960223002: Add missing schemes to RecordMainFrameNavigation (Closed)
Patch Set: Fix build.gn and DEPS Created 3 years, 5 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 | « components/navigation_metrics/DEPS ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/navigation_metrics/navigation_metrics.h" 5 #include "components/navigation_metrics/navigation_metrics.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "components/dom_distiller/core/url_constants.h"
9 #include "url/gurl.h" 10 #include "url/gurl.h"
10 11
11 namespace { 12 namespace {
12 13
13 // This enum is used in building the histogram. So, this is append only, 14 // These values are written to logs. New enum values can be added, but existing
14 // any new scheme should be added at the end, before SCHEME_MAX 15 // enums must never be renumbered or deleted and reused. Any new scheme should
16 // be added at the end, before SCHEME_MAX.
15 enum Scheme { 17 enum Scheme {
16 SCHEME_UNKNOWN, 18 SCHEME_UNKNOWN = 0,
17 SCHEME_HTTP, 19 SCHEME_HTTP = 1,
18 SCHEME_HTTPS, 20 SCHEME_HTTPS = 2,
19 SCHEME_FILE, 21 SCHEME_FILE = 3,
20 SCHEME_FTP, 22 SCHEME_FTP = 4,
21 SCHEME_DATA, 23 SCHEME_DATA = 5,
22 SCHEME_JAVASCRIPT, 24 SCHEME_JAVASCRIPT = 6,
23 SCHEME_ABOUT, 25 SCHEME_ABOUT = 7,
24 SCHEME_CHROME, 26 SCHEME_CHROME = 8,
25 SCHEME_BLOB, 27 SCHEME_BLOB = 9,
26 SCHEME_FILESYSTEM, 28 SCHEME_FILESYSTEM = 10,
29 SCHEME_CHROME_NATIVE = 11,
30 SCHEME_CHROME_SEARCH = 12,
31 SCHEME_CHROME_DISTILLER = 13,
32 SCHEME_CHROME_DEVTOOLS = 14,
33 SCHEME_CHROME_EXTENSION = 15,
34 SCHEME_VIEW_SOURCE = 16,
35 SCHEME_EXTERNALFILE = 17,
27 SCHEME_MAX, 36 SCHEME_MAX,
28 }; 37 };
29 38
30 const char* const kSchemeNames[] = { 39 const char* const kSchemeNames[] = {
31 "unknown", 40 "unknown",
32 url::kHttpScheme, 41 url::kHttpScheme,
33 url::kHttpsScheme, 42 url::kHttpsScheme,
34 url::kFileScheme, 43 url::kFileScheme,
35 url::kFtpScheme, 44 url::kFtpScheme,
36 url::kDataScheme, 45 url::kDataScheme,
37 url::kJavaScriptScheme, 46 url::kJavaScriptScheme,
38 url::kAboutScheme, 47 url::kAboutScheme,
39 "chrome", 48 "chrome",
40 url::kBlobScheme, 49 url::kBlobScheme,
41 url::kFileSystemScheme, 50 url::kFileSystemScheme,
42 "max", 51 "chrome-native",
52 "chrome-search",
53 dom_distiller::kDomDistillerScheme,
54 "chrome-devtools",
55 "chrome-extension",
56 "view-source",
57 "externalfile",
43 }; 58 };
44 59
45 static_assert(arraysize(kSchemeNames) == SCHEME_MAX + 1, 60 static_assert(arraysize(kSchemeNames) == SCHEME_MAX,
46 "kSchemeNames should have SCHEME_MAX + 1 elements"); 61 "kSchemeNames should have SCHEME_MAX elements");
47 62
48 } // namespace 63 } // namespace
49 64
50 namespace navigation_metrics { 65 namespace navigation_metrics {
51 66
52 void RecordMainFrameNavigation(const GURL& url, 67 void RecordMainFrameNavigation(const GURL& url,
53 bool is_same_document, 68 bool is_same_document,
54 bool is_off_the_record) { 69 bool is_off_the_record) {
55 Scheme scheme = SCHEME_UNKNOWN; 70 Scheme scheme = SCHEME_UNKNOWN;
56 for (int i = 1; i < SCHEME_MAX; ++i) { 71 for (int i = 1; i < SCHEME_MAX; ++i) {
(...skipping 13 matching lines...) Expand all
70 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameSchemeOTR", scheme, 85 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameSchemeOTR", scheme,
71 SCHEME_MAX); 86 SCHEME_MAX);
72 if (!is_same_document) { 87 if (!is_same_document) {
73 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameSchemeDifferentPageOTR", 88 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameSchemeDifferentPageOTR",
74 scheme, SCHEME_MAX); 89 scheme, SCHEME_MAX);
75 } 90 }
76 } 91 }
77 } 92 }
78 93
79 } // namespace navigation_metrics 94 } // namespace navigation_metrics
OLDNEW
« no previous file with comments | « components/navigation_metrics/DEPS ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698