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

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: responding to comments 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 // Track whether the page loaded is a search results page (SRP). Track
59 // the non-SRP navigations as well so there is a control.
60 content::RecordAction(content::UserMetricsAction("NavEntryCommitted"));
61 if (TemplateURLServiceFactory::GetForProfile(
62 Profile::FromBrowserContext(controller->GetBrowserContext()))->
63 IsSearchResultsPageFromDefaultSearchProvider(
Mark P 2013/08/06 23:17:47 indent four less ditto line below (or actually you
rpetterson 2013/08/06 23:41:31 I don't understand your comment. "load.entry->GetU
Mark P 2013/08/06 23:57:17 You indent more if you're at a deeper level than b
rpetterson 2013/08/07 00:18:24 Done. Sadly load.entry->GetURL() still doesn't fit
64 load.entry->GetURL())) {
65 content::RecordAction(
66 content::UserMetricsAction("NavEntryCommitted.SRP"));
67 }
68
50 if (!load.is_navigation_to_different_page()) 69 if (!load.is_navigation_to_different_page())
51 return; // Don't log for subframes or other trivial types. 70 return; // Don't log for subframes or other trivial types.
52 71
53 LogRenderProcessHostCount(); 72 LogRenderProcessHostCount();
54 LogBrowserTabCount(); 73 LogBrowserTabCount();
55 } else if (type == chrome::NOTIFICATION_APP_TERMINATING) { 74 } else if (type == chrome::NOTIFICATION_APP_TERMINATING) {
56 delete g_instance; 75 delete g_instance;
57 g_instance = NULL; 76 g_instance = NULL;
58 } 77 }
59 } 78 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Record how many windows are open, by type. 120 // Record how many windows are open, by type.
102 UMA_HISTOGRAM_COUNTS_100("WindowManager.AppWindowCountPerLoad", 121 UMA_HISTOGRAM_COUNTS_100("WindowManager.AppWindowCountPerLoad",
103 app_window_count); 122 app_window_count);
104 UMA_HISTOGRAM_COUNTS_100("WindowManager.PopUpWindowCountPerLoad", 123 UMA_HISTOGRAM_COUNTS_100("WindowManager.PopUpWindowCountPerLoad",
105 popup_window_count); 124 popup_window_count);
106 UMA_HISTOGRAM_COUNTS_100("WindowManager.TabbedWindowCountPerLoad", 125 UMA_HISTOGRAM_COUNTS_100("WindowManager.TabbedWindowCountPerLoad",
107 tabbed_window_count); 126 tabbed_window_count);
108 } 127 }
109 128
110 } // namespace chrome 129 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698