OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_ANDROID_MEDIA_PLAYERS_OBSERVER_H_ | |
6 #define CONTENT_BROWSER_ANDROID_MEDIA_PLAYERS_OBSERVER_H_ | |
7 | |
8 #include <map> | |
no sievers
2015/02/25 21:22:04
nit: space after line 8
Tima Vaisburd
2015/02/28 03:16:05
Done.
| |
9 #include "base/macros.h" | |
10 #include "content/browser/media/audio_state_provider.h" | |
11 | |
12 namespace content { | |
13 | |
14 class RenderFrameHost; | |
15 | |
16 // On Android the MediaPlayerAndroid objects report | |
17 // the audible state to us. | |
18 class MediaPlayersObserver : public AudioStateProvider { | |
19 public: | |
20 explicit MediaPlayersObserver(WebContents* web_contents); | |
21 ~MediaPlayersObserver() override; | |
22 | |
23 // This audio state provider does not have a monitor, | |
24 // the method returns nullptr. | |
25 AudioStreamMonitor* audio_stream_monitor() override; | |
26 | |
27 // These methods constitute the observer pattern, should | |
28 // be called when corresponding event happens. They will notify | |
29 // WebContents whenever its audible state as a whole changes. | |
30 void OnAudibleStateChanged(RenderFrameHost* rfh, int player_id, | |
31 bool is_audible); | |
32 void RemovePlayer(RenderFrameHost* rfh, int player_id); | |
33 void RenderFrameDeleted(RenderFrameHost* rfh); | |
34 | |
35 private: | |
36 void UpdateStatusAndNotify(); | |
37 | |
38 // Audible status per player ID and frame | |
39 typedef std::pair<RenderFrameHost*, int> Key; | |
40 typedef std::map<Key, bool> StatusMap; | |
41 StatusMap audio_status_map_; | |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(MediaPlayersObserver); | |
44 }; | |
45 | |
46 } // namespace content | |
47 | |
48 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYERS_OBSERVER_H_ | |
OLD | NEW |