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

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

Issue 35693009: Move Navigation.MainFrameScheme UMA recording to //components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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
(Empty)
1 // Copyright (c) 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.
4
5 #include "components/navigation_metrics/navigation_metrics.h"
6
7 #include "base/metrics/histogram.h"
8
9 namespace {
10
11 enum Scheme {
12 SCHEME_UNKNOWN,
13 SCHEME_HTTP,
14 SCHEME_HTTPS,
15 SCHEME_FILE,
16 SCHEME_FTP,
17 SCHEME_DATA,
18 SCHEME_JAVASCRIPT,
19 SCHEME_ABOUT,
20 SCHEME_CHROME,
21 SCHEME_MAX,
22 };
23
24 static const char* kSchemeNames[] = {
25 "unknown",
26 "http",
27 "https",
28 "file",
29 "ftp",
30 "data",
31 "javascript",
32 "about",
33 "chrome",
34 "max",
35 };
36
37 COMPILE_ASSERT(arraysize(kSchemeNames) == SCHEME_MAX + 1,
38 NavigationMetricsRecorder_name_count_mismatch);
39
40 } // namespace
41
42 namespace navigation_metrics {
43
44 void RecordMainFrameNavigation(const GURL& url) {
45 Scheme scheme = SCHEME_UNKNOWN;
46 for (int i = 1; i < SCHEME_MAX; ++i) {
47 if (url.SchemeIs(kSchemeNames[i])) {
48 scheme = static_cast<Scheme>(i);
49 break;
50 }
51 }
52 UMA_HISTOGRAM_ENUMERATION(
53 "Navigation.MainFrameScheme", scheme, SCHEME_MAX);
54 }
55
56 } // namespace navigation_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698