| 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 CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_H_ | 6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 static bool RegisterMediaSession(JNIEnv* env); | 41 static bool RegisterMediaSession(JNIEnv* env); |
| 42 | 42 |
| 43 // Returns the MediaSession associated to this WebContents. Creates one if | 43 // Returns the MediaSession associated to this WebContents. Creates one if |
| 44 // none is currently available. | 44 // none is currently available. |
| 45 static MediaSession* Get(WebContents* web_contents); | 45 static MediaSession* Get(WebContents* web_contents); |
| 46 | 46 |
| 47 ~MediaSession() override; | 47 ~MediaSession() override; |
| 48 | 48 |
| 49 bool Activate(); |
| 50 void Deactivate(); |
| 51 |
| 49 // Adds the given player to the current media session. Returns whether the | 52 // Adds the given player to the current media session. Returns whether the |
| 50 // player was successfully added. If it returns false, AddPlayer() should be | 53 // player was successfully added. If it returns false, AddPlayer() should be |
| 51 // called again later. | 54 // called again later. |
| 52 bool AddPlayer(MediaSessionObserver* observer, int player_id, Type type); | 55 bool AddPlayer(MediaSessionObserver* observer, int player_id, Type type); |
| 53 | 56 |
| 54 // Removes the given player from the current media session. Abandons audio | 57 // Removes the given player from the current media session. Abandons audio |
| 55 // focus if that was the last player in the session. | 58 // focus if that was the last player in the session. |
| 56 void RemovePlayer(MediaSessionObserver* observer, int player_id); | 59 void RemovePlayer(MediaSessionObserver* observer, int player_id); |
| 57 | 60 |
| 58 // Removes all the players associated with |observer|. Abandons audio focus if | 61 // Removes all the players associated with |observer|. Abandons audio focus if |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 State audio_focus_state_; | 153 State audio_focus_state_; |
| 151 SuspendType suspend_type_; | 154 SuspendType suspend_type_; |
| 152 Type audio_focus_type_; | 155 Type audio_focus_type_; |
| 153 | 156 |
| 154 DISALLOW_COPY_AND_ASSIGN(MediaSession); | 157 DISALLOW_COPY_AND_ASSIGN(MediaSession); |
| 155 }; | 158 }; |
| 156 | 159 |
| 157 } // namespace content | 160 } // namespace content |
| 158 | 161 |
| 159 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_H_ | 162 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_H_ |
| OLD | NEW |