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 CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_CONTROLLER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_CONTROLLER_H_ |
6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_CONTROLLER_H_ | 6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_CONTROLLER_H_ |
7 | 7 |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "content/browser/media/android/media_session_observer.h" | 9 #include "content/browser/media/android/media_session_observer.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // Note: Once a session has been initialized with |has_audio| as true, all | 34 // Note: Once a session has been initialized with |has_audio| as true, all |
35 // future calls to Initialize() will retain this flag. | 35 // future calls to Initialize() will retain this flag. |
36 // TODO(dalecurtis): Delete sticky audio once we're no longer using WMPA and | 36 // TODO(dalecurtis): Delete sticky audio once we're no longer using WMPA and |
37 // the BrowserMediaPlayerManagers. Tracked by http://crbug.com/580626 | 37 // the BrowserMediaPlayerManagers. Tracked by http://crbug.com/580626 |
38 bool Initialize(bool has_audio, bool is_remote, base::TimeDelta duration); | 38 bool Initialize(bool has_audio, bool is_remote, base::TimeDelta duration); |
39 | 39 |
40 // Must be called when a pause occurs on the renderer side media player; keeps | 40 // Must be called when a pause occurs on the renderer side media player; keeps |
41 // the MediaSession instance in sync with renderer side behavior. | 41 // the MediaSession instance in sync with renderer side behavior. |
42 void OnPlaybackPaused(); | 42 void OnPlaybackPaused(); |
43 | 43 |
| 44 bool is_playing() const { return is_playing_; } |
| 45 |
44 // MediaSessionObserver implementation. | 46 // MediaSessionObserver implementation. |
45 void OnSuspend(int player_id) override; | 47 void OnSuspend(int player_id) override; |
46 void OnResume(int player_id) override; | 48 void OnResume(int player_id) override; |
47 void OnSetVolumeMultiplier(int player_id, double volume_multiplier) override; | 49 void OnSetVolumeMultiplier(int player_id, double volume_multiplier) override; |
48 | 50 |
49 // Test helpers. | 51 // Test helpers. |
50 int get_player_id_for_testing() const { return player_id_; } | 52 int get_player_id_for_testing() const { return player_id_; } |
51 | 53 |
52 private: | 54 private: |
53 const WebContentsObserver::MediaPlayerId id_; | 55 const WebContentsObserver::MediaPlayerId id_; |
54 | 56 |
55 // Non-owned pointer; |media_web_contents_observer_| is the owner of |this|. | 57 // Non-owned pointer; |media_web_contents_observer_| is the owner of |this|. |
56 MediaWebContentsObserver* const media_web_contents_observer_; | 58 MediaWebContentsObserver* const media_web_contents_observer_; |
57 | 59 |
58 // Non-owned pointer; lifetime is the same as |media_web_contents_observer_|. | 60 // Non-owned pointer; lifetime is the same as |media_web_contents_observer_|. |
59 MediaSession* const media_session_; | 61 MediaSession* const media_session_; |
60 | 62 |
61 int player_id_ = 0; | 63 int player_id_ = 0; |
62 bool has_session_ = false; | 64 bool has_session_ = false; |
| 65 bool is_playing_ = false; |
63 | 66 |
64 DISALLOW_COPY_AND_ASSIGN(MediaSessionController); | 67 DISALLOW_COPY_AND_ASSIGN(MediaSessionController); |
65 }; | 68 }; |
66 | 69 |
67 } // namespace content | 70 } // namespace content |
68 | 71 |
69 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_CONTROLLER_H_ | 72 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_CONTROLLER_H_ |
OLD | NEW |