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

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

Issue 1844753002: Histogram the scheme of an origin on the 1st navigation to it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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.h" 8 #include "base/metrics/histogram.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 10
(...skipping 29 matching lines...) Expand all
40 "max", 40 "max",
41 }; 41 };
42 42
43 static_assert(arraysize(kSchemeNames) == SCHEME_MAX + 1, 43 static_assert(arraysize(kSchemeNames) == SCHEME_MAX + 1,
44 "kSchemeNames should have SCHEME_MAX + 1 elements"); 44 "kSchemeNames should have SCHEME_MAX + 1 elements");
45 45
46 } // namespace 46 } // namespace
47 47
48 namespace navigation_metrics { 48 namespace navigation_metrics {
49 49
50 void RecordMainFrameNavigation(const GURL& url, bool is_in_page) { 50 void RecordMainFrameNavigation(const GURL& url,
51 bool is_in_page,
52 bool is_off_the_record) {
51 Scheme scheme = SCHEME_UNKNOWN; 53 Scheme scheme = SCHEME_UNKNOWN;
52 for (int i = 1; i < SCHEME_MAX; ++i) { 54 for (int i = 1; i < SCHEME_MAX; ++i) {
53 if (url.SchemeIs(kSchemeNames[i])) { 55 if (url.SchemeIs(kSchemeNames[i])) {
54 scheme = static_cast<Scheme>(i); 56 scheme = static_cast<Scheme>(i);
55 break; 57 break;
56 } 58 }
57 } 59 }
58 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameScheme", scheme, SCHEME_MAX); 60
59 if (!is_in_page) { 61 const char* enumeration_mfs = "Navigation.MainFrameScheme";
60 UMA_HISTOGRAM_ENUMERATION( 62 const char* enumeration_mfs_dp = "Navigation.MainFrameSchemeDifferentPage";
61 "Navigation.MainFrameSchemeDifferentPage", scheme, SCHEME_MAX); 63 if (is_off_the_record) {
64 enumeration_mfs = "Navigation.IncognitoMainFrameScheme";
65 enumeration_mfs_dp = "Navigation.IncognitoMainFrameSchemeDifferentPage";
62 } 66 }
67 UMA_HISTOGRAM_ENUMERATION(enumeration_mfs, scheme, SCHEME_MAX);
felt 2016/04/01 00:01:59 Does this actually work? I thought the histogram m
palmer 2016/04/05 23:42:18 It compiles and runs, but the comments about lazy
68 if (!is_in_page)
69 UMA_HISTOGRAM_ENUMERATION(enumeration_mfs_dp, scheme, SCHEME_MAX);
63 } 70 }
64 71
65 } // namespace navigation_metrics 72 } // namespace navigation_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698