OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_METRICS_DESKTOP_ENGAGEMENT_AUDIBLE_CONTENTS_TRACKER_H_ | 5 #ifndef CHROME_BROWSER_METRICS_DESKTOP_SESSION_DURATION_AUDIBLE_CONTENTS_TRACKER _H_ |
6 #define CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_AUDIBLE_CONTENTS_TRACKER_H_ | 6 #define CHROME_BROWSER_METRICS_DESKTOP_SESSION_DURATION_AUDIBLE_CONTENTS_TRACKER _H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "chrome/browser/ui/browser_list_observer.h" | 11 #include "chrome/browser/ui/browser_list_observer.h" |
12 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 12 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
13 | 13 |
14 namespace metrics { | 14 namespace metrics { |
15 | 15 |
16 // BrowserList / TabStripModelObserver used for tracking audio status. | 16 // BrowserList / TabStripModelObserver used for tracking audio status. |
17 class AudibleContentsTracker : public chrome::BrowserListObserver, | 17 class AudibleContentsTracker : public chrome::BrowserListObserver, |
18 public TabStripModelObserver { | 18 public TabStripModelObserver { |
19 public: | 19 public: |
20 // Interface for an observer of the AudibleContentsTracker. The only client | 20 // Interface for an observer of the AudibleContentsTracker. The only client |
21 // of this class is the DesktopEngagementService, but an observer interface | 21 // of this class is the DesktopSessionDurationTracker, but an observer |
22 // has been created for ease of testing. | 22 // interface has been created for ease of testing. |
23 class Observer { | 23 class Observer { |
sky
2016/09/15 03:04:05
for a later patch: Style guide says observers shou
| |
24 public: | 24 public: |
25 Observer() {} | 25 Observer() {} |
26 virtual ~Observer() {} | 26 virtual ~Observer() {} |
27 | 27 |
28 // Invoked when a first audio source starts playing after a period of no | 28 // Invoked when a first audio source starts playing after a period of no |
29 // audio sources. | 29 // audio sources. |
30 virtual void OnAudioStart() = 0; | 30 virtual void OnAudioStart() = 0; |
31 | 31 |
32 // Invoked when all audio sources stop playing. | 32 // Invoked when all audio sources stop playing. |
33 virtual void OnAudioEnd() = 0; | 33 virtual void OnAudioEnd() = 0; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 Observer* observer_; | 66 Observer* observer_; |
67 | 67 |
68 // The set of WebContents that are currently playing audio. | 68 // The set of WebContents that are currently playing audio. |
69 std::set<content::WebContents*> audible_contents_; | 69 std::set<content::WebContents*> audible_contents_; |
70 | 70 |
71 DISALLOW_COPY_AND_ASSIGN(AudibleContentsTracker); | 71 DISALLOW_COPY_AND_ASSIGN(AudibleContentsTracker); |
72 }; | 72 }; |
73 | 73 |
74 } // namespace metrics | 74 } // namespace metrics |
75 | 75 |
76 #endif // CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_AUDIBLE_CONTENTS_TRACKER_H_ | 76 #endif // CHROME_BROWSER_METRICS_DESKTOP_SESSION_DURATION_AUDIBLE_CONTENTS_TRAC KER_H_ |
OLD | NEW |