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

Side by Side Diff: chrome/browser/tab_contents/navigation_metrics_recorder.cc

Issue 10831048: Record navigations by URL scheme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove PowerSaveBlocker Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 "chrome/browser/tab_contents/navigation_metrics_recorder.h"
6
7 #include "base/metrics/histogram.h"
8 #include "content/public/browser/navigation_details.h"
9 #include "content/public/browser/navigation_entry.h"
10
11 namespace {
12
13 enum Scheme {
14 SCHEME_UNKNOWN,
15 SCHEME_HTTP,
16 SCHEME_HTTPS,
17 SCHEME_FILE,
18 SCHEME_FTP,
19 SCHEME_DATA,
20 SCHEME_JAVASCRIPT,
21 SCHEME_ABOUT,
22 SCHEME_CHROME,
23 SCHEME_MAX,
24 };
25
26 static const char* kSchemeNames[] = {
27 "unknown",
28 "http",
29 "https",
30 "file",
31 "ftp",
32 "data",
33 "javascript",
34 "about",
35 "chrome",
36 "max",
37 };
38
39 COMPILE_ASSERT(arraysize(kSchemeNames) == SCHEME_MAX + 1,
40 NavigationMetricsRecorder_name_count_mismatch);
41
42 void RecordMainFrameNavigation(const content::LoadCommittedDetails& details) {
43 GURL url = details.entry->GetVirtualURL();
44 Scheme scheme = SCHEME_UNKNOWN;
45 for (int i = 1; i < SCHEME_MAX; ++i) {
46 if (url.SchemeIs(kSchemeNames[i])) {
47 scheme = static_cast<Scheme>(i);
48 break;
49 }
50 }
51 UMA_HISTOGRAM_ENUMERATION(
52 "Navigation.MainFrameScheme", scheme, SCHEME_MAX);
53 }
54
55 } // namespace
56
57 NavigationMetricsRecorder::NavigationMetricsRecorder(
58 content::WebContents* web_contents)
59 : content::WebContentsObserver(web_contents) {
60 }
61
62 NavigationMetricsRecorder::~NavigationMetricsRecorder() {
63 }
64
65 void NavigationMetricsRecorder::DidNavigateMainFrame(
66 const content::LoadCommittedDetails& details,
67 const content::FrameNavigateParams& params) {
68 RecordMainFrameNavigation(details);
69 }
70
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/navigation_metrics_recorder.h ('k') | chrome/browser/ui/tab_contents/tab_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698