OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SESSIONS_SESSION_RESTORE_STATS_COLLECTOR_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_RESTORE_STATS_COLLECTOR_H_ |
6 #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_STATS_COLLECTOR_H_ | 6 #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_STATS_COLLECTOR_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback_list.h" | 10 #include "base/callback_list.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 // SessionRestoreStatsCollector observes SessionRestore events ands records UMA | 21 // SessionRestoreStatsCollector observes SessionRestore events ands records UMA |
22 // accordingly. | 22 // accordingly. |
23 class SessionRestoreStatsCollector | 23 class SessionRestoreStatsCollector |
24 : public content::NotificationObserver, | 24 : public content::NotificationObserver, |
25 public base::RefCounted<SessionRestoreStatsCollector> { | 25 public base::RefCounted<SessionRestoreStatsCollector> { |
26 public: | 26 public: |
27 // Called to start tracking tabs. If a restore is already occuring, the tabs | 27 // Called to start tracking tabs. If a restore is already occuring, the tabs |
28 // are added to the existing list of tracked tabs. | 28 // are added to the existing list of tracked tabs. |
29 static void TrackTabs( | 29 static void TrackTabs( |
30 const std::vector<SessionRestoreDelegate::RestoredTab>& tabs, | 30 const std::vector<SessionRestoreDelegate::RestoredTab>& tabs, |
31 const base::TimeTicks& restore_started); | 31 const base::TimeTicks& restore_started, |
32 bool active_only); | |
gab
2015/04/07 12:33:03
nit: Add a comment to state what |active_only| mea
| |
32 | 33 |
33 private: | 34 private: |
34 friend class base::RefCounted<SessionRestoreStatsCollector>; | 35 friend class base::RefCounted<SessionRestoreStatsCollector>; |
35 | 36 |
36 using RenderWidgetHostSet = std::set<content::RenderWidgetHost*>; | 37 using RenderWidgetHostSet = std::set<content::RenderWidgetHost*>; |
37 | 38 |
38 explicit SessionRestoreStatsCollector(const base::TimeTicks& restore_started); | 39 explicit SessionRestoreStatsCollector(const base::TimeTicks& restore_started); |
39 ~SessionRestoreStatsCollector() override; | 40 ~SessionRestoreStatsCollector() override; |
40 | 41 |
41 // NotificationObserver method. | 42 // NotificationObserver method. |
42 void Observe(int type, | 43 void Observe(int type, |
43 const content::NotificationSource& source, | 44 const content::NotificationSource& source, |
44 const content::NotificationDetails& details) override; | 45 const content::NotificationDetails& details) override; |
45 | 46 |
46 // Adds new tabs to the list of tracked tabs. | 47 // Adds new tabs to the list of tracked tabs. |
47 void AddTabs(const std::vector<SessionRestoreDelegate::RestoredTab>& tabs); | 48 void AddTabs(const std::vector<SessionRestoreDelegate::RestoredTab>& tabs, |
49 bool active_only); | |
48 | 50 |
49 // Called when a tab is no longer tracked. | 51 // Called when a tab is no longer tracked. |
50 void RemoveTab(content::NavigationController* tab); | 52 void RemoveTab(content::NavigationController* tab); |
51 | 53 |
52 // Registers for relevant notifications for a tab. | 54 // Registers for relevant notifications for a tab. |
53 void RegisterForNotifications(content::NavigationController* tab); | 55 void RegisterForNotifications(content::NavigationController* tab); |
54 | 56 |
55 // Returns the RenderWidgetHost of a tab. | 57 // Returns the RenderWidgetHost of a tab. |
56 content::RenderWidgetHost* GetRenderWidgetHost( | 58 content::RenderWidgetHost* GetRenderWidgetHost( |
57 content::NavigationController* tab); | 59 content::NavigationController* tab); |
(...skipping 29 matching lines...) Expand all Loading... | |
87 scoped_refptr<SessionRestoreStatsCollector> this_retainer_; | 89 scoped_refptr<SessionRestoreStatsCollector> this_retainer_; |
88 | 90 |
89 // The shared SessionRestoreNotifier instance for all SessionRestores running | 91 // The shared SessionRestoreNotifier instance for all SessionRestores running |
90 // at this time. | 92 // at this time. |
91 static SessionRestoreStatsCollector* shared_collector_; | 93 static SessionRestoreStatsCollector* shared_collector_; |
92 | 94 |
93 DISALLOW_COPY_AND_ASSIGN(SessionRestoreStatsCollector); | 95 DISALLOW_COPY_AND_ASSIGN(SessionRestoreStatsCollector); |
94 }; | 96 }; |
95 | 97 |
96 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_STATS_COLLECTOR_H_ | 98 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_STATS_COLLECTOR_H_ |
OLD | NEW |