OLD | NEW |
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_factory.h" | 9 #include "chrome/browser/search_engines/template_url_service_factory.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_finder.h" | 11 #include "chrome/browser/ui/browser_finder.h" |
12 #include "chrome/browser/ui/browser_iterator.h" | 12 #include "chrome/browser/ui/browser_list.h" |
13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
15 #include "components/search_engines/template_url_service.h" | 15 #include "components/search_engines/template_url_service.h" |
16 #include "content/public/browser/navigation_controller.h" | 16 #include "content/public/browser/navigation_controller.h" |
17 #include "content/public/browser/navigation_details.h" | 17 #include "content/public/browser/navigation_details.h" |
18 #include "content/public/browser/navigation_entry.h" | 18 #include "content/public/browser/navigation_entry.h" |
19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
20 #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" | 21 #include "content/public/browser/user_metrics.h" |
22 | 22 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ++hosts_count; | 89 ++hosts_count; |
90 UMA_HISTOGRAM_CUSTOM_COUNTS("MPArch.RPHCountPerLoad", hosts_count, | 90 UMA_HISTOGRAM_CUSTOM_COUNTS("MPArch.RPHCountPerLoad", hosts_count, |
91 1, 50, 50); | 91 1, 50, 50); |
92 } | 92 } |
93 | 93 |
94 void UMABrowsingActivityObserver::LogBrowserTabCount() const { | 94 void UMABrowsingActivityObserver::LogBrowserTabCount() const { |
95 int tab_count = 0; | 95 int tab_count = 0; |
96 int app_window_count = 0; | 96 int app_window_count = 0; |
97 int popup_window_count = 0; | 97 int popup_window_count = 0; |
98 int tabbed_window_count = 0; | 98 int tabbed_window_count = 0; |
99 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 99 for (auto* browser : *BrowserList::GetInstance()) { |
100 // Record how many tabs each window has open. | 100 // Record how many tabs each window has open. |
101 Browser* browser = *it; | |
102 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountPerWindow", | 101 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountPerWindow", |
103 browser->tab_strip_model()->count(), | 102 browser->tab_strip_model()->count(), |
104 1, 200, 50); | 103 1, 200, 50); |
105 tab_count += browser->tab_strip_model()->count(); | 104 tab_count += browser->tab_strip_model()->count(); |
106 | 105 |
107 if (browser->window()->IsActive()) { | 106 if (browser->window()->IsActive()) { |
108 // Record how many tabs the active window has open. | 107 // Record how many tabs the active window has open. |
109 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountActiveWindow", | 108 UMA_HISTOGRAM_CUSTOM_COUNTS("Tabs.TabCountActiveWindow", |
110 browser->tab_strip_model()->count(), | 109 browser->tab_strip_model()->count(), |
111 1, 200, 50); | 110 1, 200, 50); |
(...skipping 12 matching lines...) Expand all Loading... |
124 // Record how many windows are open, by type. | 123 // Record how many windows are open, by type. |
125 UMA_HISTOGRAM_COUNTS_100("WindowManager.AppWindowCountPerLoad", | 124 UMA_HISTOGRAM_COUNTS_100("WindowManager.AppWindowCountPerLoad", |
126 app_window_count); | 125 app_window_count); |
127 UMA_HISTOGRAM_COUNTS_100("WindowManager.PopUpWindowCountPerLoad", | 126 UMA_HISTOGRAM_COUNTS_100("WindowManager.PopUpWindowCountPerLoad", |
128 popup_window_count); | 127 popup_window_count); |
129 UMA_HISTOGRAM_COUNTS_100("WindowManager.TabbedWindowCountPerLoad", | 128 UMA_HISTOGRAM_COUNTS_100("WindowManager.TabbedWindowCountPerLoad", |
130 tabbed_window_count); | 129 tabbed_window_count); |
131 } | 130 } |
132 | 131 |
133 } // namespace chrome | 132 } // namespace chrome |
OLD | NEW |