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

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

Issue 2771233002: Remove the wrapper functions content::RecordAction et al (Closed)
Patch Set: Rebased Created 3 years, 8 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
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_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/metrics/user_metrics.h"
8 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/search_engines/template_url_service_factory.h" 10 #include "chrome/browser/search_engines/template_url_service_factory.h"
10 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_finder.h" 12 #include "chrome/browser/ui/browser_finder.h"
12 #include "chrome/browser/ui/browser_list.h" 13 #include "chrome/browser/ui/browser_list.h"
13 #include "chrome/browser/ui/browser_window.h" 14 #include "chrome/browser/ui/browser_window.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "components/search_engines/template_url_service.h" 16 #include "components/search_engines/template_url_service.h"
16 #include "content/public/browser/navigation_controller.h" 17 #include "content/public/browser/navigation_controller.h"
17 #include "content/public/browser/navigation_details.h" 18 #include "content/public/browser/navigation_details.h"
18 #include "content/public/browser/navigation_entry.h" 19 #include "content/public/browser/navigation_entry.h"
19 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
21 #include "content/public/browser/user_metrics.h"
22 22
23 namespace chrome { 23 namespace chrome {
24 namespace { 24 namespace {
25 25
26 UMABrowsingActivityObserver* g_instance = NULL; 26 UMABrowsingActivityObserver* g_instance = NULL;
27 27
28 } // namespace 28 } // namespace
29 29
30 // static 30 // static
31 void UMABrowsingActivityObserver::Init() { 31 void UMABrowsingActivityObserver::Init() {
(...skipping 18 matching lines...) Expand all
50 const content::NotificationSource& source, 50 const content::NotificationSource& source,
51 const content::NotificationDetails& details) { 51 const content::NotificationDetails& details) {
52 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { 52 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) {
53 const content::LoadCommittedDetails load = 53 const content::LoadCommittedDetails load =
54 *content::Details<content::LoadCommittedDetails>(details).ptr(); 54 *content::Details<content::LoadCommittedDetails>(details).ptr();
55 55
56 content::NavigationController* controller = 56 content::NavigationController* controller =
57 content::Source<content::NavigationController>(source).ptr(); 57 content::Source<content::NavigationController>(source).ptr();
58 // Track whether the page loaded is a search results page (SRP). Track 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. 59 // the non-SRP navigations as well so there is a control.
60 content::RecordAction(base::UserMetricsAction("NavEntryCommitted")); 60 base::RecordAction(base::UserMetricsAction("NavEntryCommitted"));
61 // Attempting to determine the cause of a crash originating from 61 // Attempting to determine the cause of a crash originating from
62 // IsSearchResultsPageFromDefaultSearchProvider but manifesting in 62 // IsSearchResultsPageFromDefaultSearchProvider but manifesting in
63 // TemplateURLRef::ExtractSearchTermsFromURL(...). 63 // TemplateURLRef::ExtractSearchTermsFromURL(...).
64 // See http://crbug.com/291348. 64 // See http://crbug.com/291348.
65 CHECK(load.entry); 65 CHECK(load.entry);
66 if (TemplateURLServiceFactory::GetForProfile( 66 if (TemplateURLServiceFactory::GetForProfile(
67 Profile::FromBrowserContext(controller->GetBrowserContext()))-> 67 Profile::FromBrowserContext(controller->GetBrowserContext()))->
68 IsSearchResultsPageFromDefaultSearchProvider( 68 IsSearchResultsPageFromDefaultSearchProvider(
69 load.entry->GetURL())) { 69 load.entry->GetURL())) {
70 content::RecordAction(base::UserMetricsAction("NavEntryCommitted.SRP")); 70 base::RecordAction(base::UserMetricsAction("NavEntryCommitted.SRP"));
71 } 71 }
72 72
73 if (!load.is_navigation_to_different_page()) 73 if (!load.is_navigation_to_different_page())
74 return; // Don't log for subframes or other trivial types. 74 return; // Don't log for subframes or other trivial types.
75 75
76 LogRenderProcessHostCount(); 76 LogRenderProcessHostCount();
77 LogBrowserTabCount(); 77 LogBrowserTabCount();
78 } else if (type == chrome::NOTIFICATION_APP_TERMINATING) { 78 } else if (type == chrome::NOTIFICATION_APP_TERMINATING) {
79 delete g_instance; 79 delete g_instance;
80 g_instance = NULL; 80 g_instance = NULL;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // Record how many windows are open, by type. 123 // Record how many windows are open, by type.
124 UMA_HISTOGRAM_COUNTS_100("WindowManager.AppWindowCountPerLoad", 124 UMA_HISTOGRAM_COUNTS_100("WindowManager.AppWindowCountPerLoad",
125 app_window_count); 125 app_window_count);
126 UMA_HISTOGRAM_COUNTS_100("WindowManager.PopUpWindowCountPerLoad", 126 UMA_HISTOGRAM_COUNTS_100("WindowManager.PopUpWindowCountPerLoad",
127 popup_window_count); 127 popup_window_count);
128 UMA_HISTOGRAM_COUNTS_100("WindowManager.TabbedWindowCountPerLoad", 128 UMA_HISTOGRAM_COUNTS_100("WindowManager.TabbedWindowCountPerLoad",
129 tabbed_window_count); 129 tabbed_window_count);
130 } 130 }
131 131
132 } // namespace chrome 132 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc ('k') | chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698