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

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

Issue 1167403002: Add blob scheme in Navigation Histograms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added 'blob' scheme in the Navigation.MainFrameScheme and Navigation.MainFrameSchemeDifferentPage h… Created 5 years, 6 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/histograms.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/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "url/gurl.h" 8 #include "url/gurl.h"
9 9
10 namespace { 10 namespace {
11 11
12 enum Scheme { 12 enum Scheme {
Ilya Sherman 2015/06/09 19:53:36 Please add documentation to indicate that this enu
Bhanu Dev 2015/06/10 00:29:02 Done.
13 SCHEME_UNKNOWN, 13 SCHEME_UNKNOWN,
14 SCHEME_HTTP, 14 SCHEME_HTTP,
15 SCHEME_HTTPS, 15 SCHEME_HTTPS,
16 SCHEME_FILE, 16 SCHEME_FILE,
17 SCHEME_FTP, 17 SCHEME_FTP,
18 SCHEME_DATA, 18 SCHEME_DATA,
19 SCHEME_JAVASCRIPT, 19 SCHEME_JAVASCRIPT,
20 SCHEME_ABOUT, 20 SCHEME_ABOUT,
21 SCHEME_CHROME, 21 SCHEME_CHROME,
22 SCHEME_BLOB,
22 SCHEME_MAX, 23 SCHEME_MAX,
23 }; 24 };
24 25
25 const char* const kSchemeNames[] = { 26 const char* const kSchemeNames[] = {
26 "unknown", 27 "unknown",
27 url::kHttpScheme, 28 url::kHttpScheme,
28 url::kHttpsScheme, 29 url::kHttpsScheme,
29 url::kFileScheme, 30 url::kFileScheme,
30 url::kFtpScheme, 31 url::kFtpScheme,
31 url::kDataScheme, 32 url::kDataScheme,
32 url::kJavaScriptScheme, 33 url::kJavaScriptScheme,
33 url::kAboutScheme, 34 url::kAboutScheme,
34 "chrome", 35 "chrome",
36 url::kBlobScheme,
35 "max", 37 "max",
36 }; 38 };
37 39
38 static_assert(arraysize(kSchemeNames) == SCHEME_MAX + 1, 40 static_assert(arraysize(kSchemeNames) == SCHEME_MAX + 1,
39 "kSchemeNames should have SCHEME_MAX + 1 elements"); 41 "kSchemeNames should have SCHEME_MAX + 1 elements");
40 42
41 } // namespace 43 } // namespace
42 44
43 namespace navigation_metrics { 45 namespace navigation_metrics {
44 46
45 void RecordMainFrameNavigation(const GURL& url, bool is_in_page) { 47 void RecordMainFrameNavigation(const GURL& url, bool is_in_page) {
46 Scheme scheme = SCHEME_UNKNOWN; 48 Scheme scheme = SCHEME_UNKNOWN;
47 for (int i = 1; i < SCHEME_MAX; ++i) { 49 for (int i = 1; i < SCHEME_MAX; ++i) {
48 if (url.SchemeIs(kSchemeNames[i])) { 50 if (url.SchemeIs(kSchemeNames[i])) {
49 scheme = static_cast<Scheme>(i); 51 scheme = static_cast<Scheme>(i);
50 break; 52 break;
51 } 53 }
52 } 54 }
53 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameScheme", scheme, SCHEME_MAX); 55 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameScheme", scheme, SCHEME_MAX);
54 if (!is_in_page) { 56 if (!is_in_page) {
55 UMA_HISTOGRAM_ENUMERATION( 57 UMA_HISTOGRAM_ENUMERATION(
56 "Navigation.MainFrameSchemeDifferentPage", scheme, SCHEME_MAX); 58 "Navigation.MainFrameSchemeDifferentPage", scheme, SCHEME_MAX);
57 } 59 }
58 } 60 }
59 61
60 } // namespace navigation_metrics 62 } // namespace navigation_metrics
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698