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

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: Address review comments. Created 7 years, 2 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
« no previous file with comments | « components/navigation_metrics/navigation_metrics.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "url/gurl.h"
9
10 namespace {
11
12 enum Scheme {
13 SCHEME_UNKNOWN,
14 SCHEME_HTTP,
15 SCHEME_HTTPS,
16 SCHEME_FILE,
17 SCHEME_FTP,
18 SCHEME_DATA,
19 SCHEME_JAVASCRIPT,
20 SCHEME_ABOUT,
21 SCHEME_CHROME,
22 SCHEME_MAX,
23 };
24
25 static const char* kSchemeNames[] = {
26 "unknown",
27 "http",
28 "https",
29 "file",
30 "ftp",
31 "data",
32 "javascript",
33 "about",
34 "chrome",
35 "max",
36 };
37
38 COMPILE_ASSERT(arraysize(kSchemeNames) == SCHEME_MAX + 1,
39 NavigationMetricsRecorder_name_count_mismatch);
40
41 } // namespace
42
43 namespace navigation_metrics {
44
45 void RecordMainFrameNavigation(const GURL& url) {
46 Scheme scheme = SCHEME_UNKNOWN;
47 for (int i = 1; i < SCHEME_MAX; ++i) {
48 if (url.SchemeIs(kSchemeNames[i])) {
49 scheme = static_cast<Scheme>(i);
50 break;
51 }
52 }
53 UMA_HISTOGRAM_ENUMERATION(
54 "Navigation.MainFrameScheme", scheme, SCHEME_MAX);
55 }
56
57 } // namespace navigation_metrics
OLDNEW
« no previous file with comments | « components/navigation_metrics/navigation_metrics.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698