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

Unified Diff: chrome/browser/metrics/tab_usage_recorder.h

Issue 2335203003: Add metrics to keep track of the tab activate/deactivate cycle (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/tab_usage_recorder.h
diff --git a/chrome/browser/metrics/tab_usage_recorder.h b/chrome/browser/metrics/tab_usage_recorder.h
new file mode 100644
index 0000000000000000000000000000000000000000..d3eca89ef7bc4095325a7c3ede952b0e4884212a
--- /dev/null
+++ b/chrome/browser/metrics/tab_usage_recorder.h
@@ -0,0 +1,39 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
Georges Khalil 2016/09/14 16:10:17 nit: 2016.
Patrick Monette 2016/09/16 00:14:00 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_METRICS_TAB_USAGE_RECORDER_H_
+#define CHROME_BROWSER_METRICS_TAB_USAGE_RECORDER_H_
+
+#include <map>
+#include <memory>
+
+#include "chrome/browser/ui/browser_list_observer.h"
+
+namespace metrics {
+
+// This class is used to record metrics about tab reactivation. Specifically,
+// it records the number of time a tab is deactivated and reactivated. The
Georges Khalil 2016/09/14 16:10:17 nit: s/time/times.
Patrick Monette 2016/09/16 00:14:00 Done.
+// ratio of both can be calculated for tabs with different properties (e.g. If
+// the tab is pinned to the tab strip) to see if they are correlated with higher
+// probability of tab reactivation.
+class TabUsageRecorder : public chrome::BrowserListObserver {
+ public:
+ static void Initialize();
+
+ TabUsageRecorder();
Georges Khalil 2016/09/14 16:10:17 Make this private?
Patrick Monette 2016/09/16 00:14:00 Done.
+ ~TabUsageRecorder();
Georges Khalil 2016/09/14 16:10:17 Add override.
Patrick Monette 2016/09/16 00:14:00 Done.
+
+ // chrome::BrowserListObserver:
+ void OnBrowserAdded(Browser* browser) override;
+ void OnBrowserRemoved(Browser* browser) override;
Georges Khalil 2016/09/14 16:10:17 Use BrowserTabStripTracker instead.
Patrick Monette 2016/09/16 00:14:00 Done. I needed to change the TabStripModelObserve
Georges Khalil 2016/09/16 18:58:35 AFAIK, the tracker should be a drop in replacement
Patrick Monette 2016/09/19 17:47:12 I meant adding a TabStripModel* parameter to the i
+
+ private:
+ class TabStripObserver;
+
+ std::map<Browser*, std::unique_ptr<TabStripObserver>> tab_strip_observer_map_;
Georges Khalil 2016/09/14 16:10:17 Comment this member. I don't see its usefulness, w
Patrick Monette 2016/09/16 00:14:00 No longer applicable as I removed it.
+};
Georges Khalil 2016/09/14 16:10:17 Disallow copy.
Patrick Monette 2016/09/16 00:14:00 Done.
+
+} // namespace metrics
+
+#endif // CHROME_BROWSER_METRICS_TAB_USAGE_RECORDER_H_

Powered by Google App Engine
This is Rietveld 408576698