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

Side by Side Diff: content/browser/android/media_players_observer.h

Issue 972973002: Revert of Propagate audible state from player to the containing tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 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>
9
10 #include "base/macros.h"
11 #include "content/browser/media/audio_state_provider.h"
12
13 namespace content {
14
15 class RenderFrameHost;
16
17 // On Android the MediaPlayerAndroid objects report
18 // the audible state to us.
19 class MediaPlayersObserver : public AudioStateProvider {
20 public:
21 explicit MediaPlayersObserver(WebContents* web_contents);
22 ~MediaPlayersObserver() override;
23
24 bool IsAudioStateAvailable() const override;
25
26 // This audio state provider does not have a monitor,
27 // the method returns nullptr.
28 AudioStreamMonitor* audio_stream_monitor() override;
29
30 // These methods constitute the observer pattern, should
31 // be called when corresponding event happens. They will notify
32 // WebContents whenever its audible state as a whole changes.
33 void OnAudibleStateChanged(RenderFrameHost* rfh, int player_id,
34 bool is_audible);
35 void RemovePlayer(RenderFrameHost* rfh, int player_id);
36 void RenderFrameDeleted(RenderFrameHost* rfh);
37
38 private:
39 void UpdateStatusAndNotify();
40
41 // Audible status per player ID and frame
42 typedef std::pair<RenderFrameHost*, int> Key;
43 typedef std::map<Key, bool> StatusMap;
44 StatusMap audio_status_map_;
45
46 DISALLOW_COPY_AND_ASSIGN(MediaPlayersObserver);
47 };
48
49 } // namespace content
50
51 #endif // CONTENT_BROWSER_ANDROID_MEDIA_PLAYERS_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/chrome_web_contents_delegate_android.cc ('k') | content/browser/android/media_players_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698