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

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: Respond to comments. 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,
53 bool have_already_seen_origin) {
51 Scheme scheme = SCHEME_UNKNOWN; 54 Scheme scheme = SCHEME_UNKNOWN;
52 for (int i = 1; i < SCHEME_MAX; ++i) { 55 for (int i = 1; i < SCHEME_MAX; ++i) {
53 if (url.SchemeIs(kSchemeNames[i])) { 56 if (url.SchemeIs(kSchemeNames[i])) {
54 scheme = static_cast<Scheme>(i); 57 scheme = static_cast<Scheme>(i);
55 break; 58 break;
56 } 59 }
57 } 60 }
58 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameScheme", scheme, SCHEME_MAX); 61
59 if (!is_in_page) { 62 if (is_off_the_record) {
60 UMA_HISTOGRAM_ENUMERATION( 63 if (!have_already_seen_origin) {
61 "Navigation.MainFrameSchemeDifferentPage", scheme, SCHEME_MAX); 64 UMA_HISTOGRAM_ENUMERATION("Navigation.SchemePerUniqueOriginOTR", scheme,
65 SCHEME_MAX);
66 }
67 } else {
felt 2016/04/07 02:28:04 nit: could you simplify this by returning early?
palmer 2016/04/07 23:45:43 Simplified in a different way.
68 if (!have_already_seen_origin) {
69 UMA_HISTOGRAM_ENUMERATION("Navigation.SchemePerUniqueOrigin", scheme,
70 SCHEME_MAX);
71 }
72 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameScheme", scheme, SCHEME_MAX);
felt 2016/04/07 02:28:04 do we still want to calculate MFS like normal for
palmer 2016/04/07 23:45:43 Oh, right. Yep!
73 if (!is_in_page) {
74 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameSchemeDifferentPage",
75 scheme, SCHEME_MAX);
76 }
62 } 77 }
63 } 78 }
64 79
65 } // namespace navigation_metrics 80 } // namespace navigation_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698