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

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: Describe |HaveAlreadySeen|'s side-effect. 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 }
61
62 if (!have_already_seen_origin) {
63 if (is_off_the_record) {
64 UMA_HISTOGRAM_ENUMERATION("Navigation.SchemePerUniqueOriginOTR", scheme,
65 SCHEME_MAX);
66 } else {
67 UMA_HISTOGRAM_ENUMERATION("Navigation.SchemePerUniqueOrigin", scheme,
68 SCHEME_MAX);
69 }
70 }
71
58 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameScheme", scheme, SCHEME_MAX); 72 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameScheme", scheme, SCHEME_MAX);
59 if (!is_in_page) { 73 if (!is_in_page) {
60 UMA_HISTOGRAM_ENUMERATION( 74 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameSchemeDifferentPage", scheme,
61 "Navigation.MainFrameSchemeDifferentPage", scheme, SCHEME_MAX); 75 SCHEME_MAX);
62 } 76 }
63 } 77 }
64 78
65 } // namespace navigation_metrics 79 } // namespace navigation_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698