Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 |
| OLD | NEW |