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