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
3 // found in the LICENSE file.
5 #include "components/navigation_metrics/navigation_metrics.h"
7 #include "base/metrics/histogram.h"
12 // This enum is used in building the histogram. So, this is append only,
13 // any new scheme should be added at the end, before SCHEME_MAX
28 const char* const kSchemeNames
[] = {
35 url::kJavaScriptScheme
,
42 static_assert(arraysize(kSchemeNames
) == SCHEME_MAX
+ 1,
43 "kSchemeNames should have SCHEME_MAX + 1 elements");
47 namespace navigation_metrics
{
49 void RecordMainFrameNavigation(const GURL
& url
, bool is_in_page
) {
50 Scheme scheme
= SCHEME_UNKNOWN
;
51 for (int i
= 1; i
< SCHEME_MAX
; ++i
) {
52 if (url
.SchemeIs(kSchemeNames
[i
])) {
53 scheme
= static_cast<Scheme
>(i
);
57 UMA_HISTOGRAM_ENUMERATION("Navigation.MainFrameScheme", scheme
, SCHEME_MAX
);
59 UMA_HISTOGRAM_ENUMERATION(
60 "Navigation.MainFrameSchemeDifferentPage", scheme
, SCHEME_MAX
);
64 } // namespace navigation_metrics