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

Side by Side Diff: chrome/browser/ui/uma_browsing_activity_observer.cc

Issue 21395002: [InstantExtended] Fixing how PageLoadSRP is emitted. Previously it was emitted only for Instant sea… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unnecessary include Created 7 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/ui/uma_browsing_activity_observer.h" 5 #include "chrome/browser/ui/uma_browsing_activity_observer.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/search_engines/template_url_service.h"
10 #include "chrome/browser/search_engines/template_url_service_factory.h"
9 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_finder.h" 12 #include "chrome/browser/ui/browser_finder.h"
11 #include "chrome/browser/ui/browser_iterator.h" 13 #include "chrome/browser/ui/browser_iterator.h"
12 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
16 #include "content/public/browser/navigation_controller.h"
14 #include "content/public/browser/navigation_details.h" 17 #include "content/public/browser/navigation_details.h"
18 #include "content/public/browser/navigation_entry.h"
15 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
16 #include "content/public/browser/render_process_host.h" 20 #include "content/public/browser/render_process_host.h"
21 #include "content/public/browser/user_metrics.h"
17 22
18 namespace chrome { 23 namespace chrome {
19 namespace { 24 namespace {
20 25
21 UMABrowsingActivityObserver* g_instance = NULL; 26 UMABrowsingActivityObserver* g_instance = NULL;
22 27
23 } // namespace 28 } // namespace
24 29
25 // static 30 // static
26 void UMABrowsingActivityObserver::Init() { 31 void UMABrowsingActivityObserver::Init() {
(...skipping 13 matching lines...) Expand all
40 UMABrowsingActivityObserver::~UMABrowsingActivityObserver() { 45 UMABrowsingActivityObserver::~UMABrowsingActivityObserver() {
41 } 46 }
42 47
43 void UMABrowsingActivityObserver::Observe( 48 void UMABrowsingActivityObserver::Observe(
44 int type, 49 int type,
45 const content::NotificationSource& source, 50 const content::NotificationSource& source,
46 const content::NotificationDetails& details) { 51 const content::NotificationDetails& details) {
47 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { 52 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) {
48 const content::LoadCommittedDetails& load = 53 const content::LoadCommittedDetails& load =
49 *content::Details<content::LoadCommittedDetails>(details).ptr(); 54 *content::Details<content::LoadCommittedDetails>(details).ptr();
55
56 content::NavigationController* controller =
57 content::Source<content::NavigationController>(source).ptr();
58 if (controller) {
Mark P 2013/08/06 19:38:36 What can cause controller to be NULL here?
Peter Kasting 2013/08/06 21:32:19 I don't think it can be.
rpetterson 2013/08/06 23:04:17 I was being overcautious. Since it's the source, I
59 // Track whether the page loaded is a search results page (SRP). Track
60 // the non-SRP navigations as well so there is a control.
61 content::RecordAction(content::UserMetricsAction("NavEntryCommitted"));
62 Profile* profile =
63 Profile::FromBrowserContext(controller->GetBrowserContext());
64 bool is_search_results =
65 TemplateURLServiceFactory::GetForProfile(profile)->
66 IsSearchResultsPageFromDefaultSearchProvider(
67 load.entry->GetURL());
68 if (is_search_results)
Mark P 2013/08/06 19:38:36 optional nit: consider inlining the alias above ra
rpetterson 2013/08/06 23:04:17 Done.
69 content::RecordAction(
70 content::UserMetricsAction("NavEntryCommitted.SRP"));
71 }
72
50 if (!load.is_navigation_to_different_page()) 73 if (!load.is_navigation_to_different_page())
51 return; // Don't log for subframes or other trivial types. 74 return; // Don't log for subframes or other trivial types.
52 75
53 LogRenderProcessHostCount(); 76 LogRenderProcessHostCount();
54 LogBrowserTabCount(); 77 LogBrowserTabCount();
55 } else if (type == chrome::NOTIFICATION_APP_TERMINATING) { 78 } else if (type == chrome::NOTIFICATION_APP_TERMINATING) {
56 delete g_instance; 79 delete g_instance;
57 g_instance = NULL; 80 g_instance = NULL;
58 } 81 }
59 } 82 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Record how many windows are open, by type. 124 // Record how many windows are open, by type.
102 UMA_HISTOGRAM_COUNTS_100("WindowManager.AppWindowCountPerLoad", 125 UMA_HISTOGRAM_COUNTS_100("WindowManager.AppWindowCountPerLoad",
103 app_window_count); 126 app_window_count);
104 UMA_HISTOGRAM_COUNTS_100("WindowManager.PopUpWindowCountPerLoad", 127 UMA_HISTOGRAM_COUNTS_100("WindowManager.PopUpWindowCountPerLoad",
105 popup_window_count); 128 popup_window_count);
106 UMA_HISTOGRAM_COUNTS_100("WindowManager.TabbedWindowCountPerLoad", 129 UMA_HISTOGRAM_COUNTS_100("WindowManager.TabbedWindowCountPerLoad",
107 tabbed_window_count); 130 tabbed_window_count);
108 } 131 }
109 132
110 } // namespace chrome 133 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698