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 #ifndef CHROME_BROWSER_UI_UMA_BROWSING_ACTIVITY_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_UI_UMA_BROWSING_ACTIVITY_OBSERVER_H_ |
6 #define CHROME_BROWSER_UI_UMA_BROWSING_ACTIVITY_OBSERVER_H_ | 6 #define CHROME_BROWSER_UI_UMA_BROWSING_ACTIVITY_OBSERVER_H_ |
7 | 7 |
| 8 #include "chrome/browser/ui/tabs/tab_strip_model_stats_recorder.h" |
| 9 #include "content/public/browser/notification_observer.h" |
8 #include "content/public/browser/notification_registrar.h" | 10 #include "content/public/browser/notification_registrar.h" |
9 #include "content/public/browser/notification_observer.h" | |
10 | 11 |
11 namespace chrome { | 12 namespace chrome { |
12 | 13 |
13 // This object is instantiated when the first Browser object is added to the | 14 // This object is instantiated when the first Browser object is added to the |
14 // list and delete when the last one is removed. It watches for loads and | 15 // list and delete when the last one is removed. It watches for loads and |
15 // creates histograms of some global object counts. | 16 // creates histograms of some global object counts. |
16 class UMABrowsingActivityObserver : public content::NotificationObserver { | 17 class UMABrowsingActivityObserver : public content::NotificationObserver { |
17 public: | 18 public: |
18 static void Init(); | 19 static void Init(); |
19 | 20 |
20 private: | 21 private: |
21 UMABrowsingActivityObserver(); | 22 UMABrowsingActivityObserver(); |
22 ~UMABrowsingActivityObserver() override; | 23 ~UMABrowsingActivityObserver() override; |
23 | 24 |
24 // content::NotificationObserver implementation. | 25 // content::NotificationObserver implementation. |
25 void Observe(int type, | 26 void Observe(int type, |
26 const content::NotificationSource& source, | 27 const content::NotificationSource& source, |
27 const content::NotificationDetails& details) override; | 28 const content::NotificationDetails& details) override; |
28 | 29 |
29 // Counts the number of active RenderProcessHosts and logs them. | 30 // Counts the number of active RenderProcessHosts and logs them. |
30 void LogRenderProcessHostCount() const; | 31 void LogRenderProcessHostCount() const; |
31 | 32 |
32 // Counts the number of tabs in each browser window and logs them. This is | 33 // Counts the number of tabs in each browser window and logs them. This is |
33 // different than the number of WebContents objects since WebContents objects | 34 // different than the number of WebContents objects since WebContents objects |
34 // can be used for popups and in dialog boxes. We're just counting toplevel | 35 // can be used for popups and in dialog boxes. We're just counting toplevel |
35 // tabs here. | 36 // tabs here. |
36 void LogBrowserTabCount() const; | 37 void LogBrowserTabCount() const; |
37 | 38 |
38 content::NotificationRegistrar registrar_; | 39 content::NotificationRegistrar registrar_; |
| 40 TabStripModelStatsRecorder tab_recorder_; |
39 | 41 |
40 DISALLOW_COPY_AND_ASSIGN(UMABrowsingActivityObserver); | 42 DISALLOW_COPY_AND_ASSIGN(UMABrowsingActivityObserver); |
41 }; | 43 }; |
42 | 44 |
43 } // namespace chrome | 45 } // namespace chrome |
44 | 46 |
45 #endif // CHROME_BROWSER_UI_UMA_BROWSING_ACTIVITY_OBSERVER_H_ | 47 #endif // CHROME_BROWSER_UI_UMA_BROWSING_ACTIVITY_OBSERVER_H_ |
OLD | NEW |