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

Side by Side Diff: chrome/browser/metrics/tab_usage_recorder.h

Issue 2335203003: Add metrics to keep track of the tab activate/deactivate cycle (Closed)
Patch Set: Moved the TabStripModelObserver change to another CL Created 4 years, 3 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
(Empty)
1 // Copyright 2016 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.
4
5 #ifndef CHROME_BROWSER_METRICS_TAB_USAGE_RECORDER_H_
6 #define CHROME_BROWSER_METRICS_TAB_USAGE_RECORDER_H_
7
8 #include "base/macros.h"
9 #include "chrome/browser/ui/browser_tab_strip_tracker.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
11
12 namespace metrics {
13
14 // This class is used to record metrics about tab reactivation. Specifically,
15 // it records the number of times a tab is deactivated and reactivated. The
16 // ratio of both can be calculated for tabs with different properties (e.g. If
17 // the tab is pinned to the tab strip) to see if they are correlated with higher
18 // probability of tab reactivation.
19 class TabUsageRecorder : public TabStripModelObserver {
20 public:
21 // Starts recording tab usage for all browsers.
22 static void Initialize();
23
24 // TabStripModelObserver:
25 void TabInsertedAt(TabStripModel* tab_strip_model,
26 content::WebContents* contents,
27 int index,
28 bool foreground) override;
29 void TabClosingAt(TabStripModel* tab_strip_model,
30 content::WebContents* contents,
31 int index) override;
32 void ActiveTabChanged(content::WebContents* old_contents,
33 content::WebContents* new_contents,
34 int index,
35 int reason) override;
36 void TabPinnedStateChanged(TabStripModel* tab_strip_model,
37 content::WebContents* contents,
38 int index) override;
39
40 private:
41 class WebContentsData;
42
43 TabUsageRecorder();
44 ~TabUsageRecorder() override;
45
46 BrowserTabStripTracker browser_tab_strip_tracker_;
47
48 DISALLOW_COPY_AND_ASSIGN(TabUsageRecorder);
49 };
50
51 } // namespace metrics
52
53 #endif // CHROME_BROWSER_METRICS_TAB_USAGE_RECORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698