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

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

Issue 2960223002: Add missing schemes to RecordMainFrameNavigation (Closed)
Patch Set: Address feedback, add more schemes 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 | « no previous file | 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 "url/gurl.h" 9 #include "url/gurl.h"
10 10
11 namespace { 11 namespace {
12 12
13 // This enum is used in building the histogram. So, this is append only, 13 // 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 14 // enums must never be renumbered or deleted and reused. Any new scheme should
15 // be added at the end, before SCHEME_MAX.
15 enum Scheme { 16 enum Scheme {
16 SCHEME_UNKNOWN, 17 SCHEME_UNKNOWN = 0,
17 SCHEME_HTTP, 18 SCHEME_HTTP = 1,
18 SCHEME_HTTPS, 19 SCHEME_HTTPS = 2,
19 SCHEME_FILE, 20 SCHEME_FILE = 3,
20 SCHEME_FTP, 21 SCHEME_FTP = 4,
21 SCHEME_DATA, 22 SCHEME_DATA = 5,
22 SCHEME_JAVASCRIPT, 23 SCHEME_JAVASCRIPT = 6,
23 SCHEME_ABOUT, 24 SCHEME_ABOUT = 7,
24 SCHEME_CHROME, 25 SCHEME_CHROME = 8,
25 SCHEME_BLOB, 26 SCHEME_BLOB = 9,
26 SCHEME_FILESYSTEM, 27 SCHEME_FILESYSTEM = 10,
28 SCHEME_CHROME_NATIVE = 11,
29 SCHEME_CHROME_SEARCH = 12,
30 SCHEME_CHROME_DISTILLER = 13,
31 SCHEME_CHROME_DEVTOOLS = 14,
32 SCHEME_CHROME_EXTENSION = 15,
33 SCHEME_VIEW_SOURCE = 16,
34 SCHEME_EXTERNALFILE = 17,
27 SCHEME_MAX, 35 SCHEME_MAX,
28 }; 36 };
29 37
30 const char* const kSchemeNames[] = { 38 const char* const kSchemeNames[] = {
31 "unknown", 39 "unknown",
32 url::kHttpScheme, 40 url::kHttpScheme,
33 url::kHttpsScheme, 41 url::kHttpsScheme,
34 url::kFileScheme, 42 url::kFileScheme,
35 url::kFtpScheme, 43 url::kFtpScheme,
36 url::kDataScheme, 44 url::kDataScheme,
37 url::kJavaScriptScheme, 45 url::kJavaScriptScheme,
38 url::kAboutScheme, 46 url::kAboutScheme,
39 "chrome", 47 "chrome",
40 url::kBlobScheme, 48 url::kBlobScheme,
41 url::kFileSystemScheme, 49 url::kFileSystemScheme,
50 "chrome-native",
Mark P 2017/06/28 17:28:42 nit: you're using raw strings here. Aren't many o
elawrence 2017/06/28 20:19:59 Yes. Unfortunately, those "various places" are mos
51 "chrome-search",
52 "chrome-distiller",
53 "chrome-devtools",
54 "chrome-extension",
55 "view-source",
56 "externalfile",
42 "max", 57 "max",
43 }; 58 };
44 59
45 static_assert(arraysize(kSchemeNames) == SCHEME_MAX + 1, 60 static_assert(arraysize(kSchemeNames) == SCHEME_MAX + 1,
46 "kSchemeNames should have SCHEME_MAX + 1 elements"); 61 "kSchemeNames should have SCHEME_MAX + 1 elements");
47 62
48 } // namespace 63 } // namespace
49 64
50 namespace navigation_metrics { 65 namespace navigation_metrics {
51 66
(...skipping 18 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 | « no previous file | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698