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

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

Issue 2960223002: Add missing schemes to RecordMainFrameNavigation (Closed)
Patch Set: Pull dom-distiller scheme from dependency 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,
51 "chrome-native",
52 "chrome-search",
53 dom_distiller::kDomDistillerScheme,
54 "chrome-devtools",
55 "chrome-extension",
56 "view-source",
57 "externalfile",
42 "max", 58 "max",
wychen 2017/06/28 23:15:11 off-topic nit: This last item doesn't seem to be n
elawrence 2017/06/29 15:15:22 Done.
43 }; 59 };
44 60
45 static_assert(arraysize(kSchemeNames) == SCHEME_MAX + 1, 61 static_assert(arraysize(kSchemeNames) == SCHEME_MAX + 1,
46 "kSchemeNames should have SCHEME_MAX + 1 elements"); 62 "kSchemeNames should have SCHEME_MAX + 1 elements");
47 63
48 } // namespace 64 } // namespace
49 65
50 namespace navigation_metrics { 66 namespace navigation_metrics {
51 67
52 void RecordMainFrameNavigation(const GURL& url, 68 void RecordMainFrameNavigation(const GURL& url,
(...skipping 17 matching lines...) Expand all
70 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameSchemeOTR", scheme, 86 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameSchemeOTR", scheme,
71 SCHEME_MAX); 87 SCHEME_MAX);
72 if (!is_same_document) { 88 if (!is_same_document) {
73 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameSchemeDifferentPageOTR", 89 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameSchemeDifferentPageOTR",
74 scheme, SCHEME_MAX); 90 scheme, SCHEME_MAX);
75 } 91 }
76 } 92 }
77 } 93 }
78 94
79 } // namespace navigation_metrics 95 } // 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