| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 MediaSessionObserver* observer; | 129 MediaSessionObserver* observer; |
| 130 int player_id; | 130 int player_id; |
| 131 }; | 131 }; |
| 132 using PlayersMap = base::hash_set<PlayerIdentifier, PlayerIdentifier::Hash>; | 132 using PlayersMap = base::hash_set<PlayerIdentifier, PlayerIdentifier::Hash>; |
| 133 | 133 |
| 134 explicit MediaSession(WebContents* web_contents); | 134 explicit MediaSession(WebContents* web_contents); |
| 135 | 135 |
| 136 // Setup the JNI. | 136 // Setup the JNI. |
| 137 void Initialize(); | 137 void Initialize(); |
| 138 | 138 |
| 139 void OnSuspendInternal(SuspendType type); | 139 void OnSuspendInternal(SuspendType type, State new_state); |
| 140 void OnResumeInternal(SuspendType type); | 140 void OnResumeInternal(SuspendType type); |
| 141 | 141 |
| 142 // Requests audio focus to Android using |j_media_session_|. | 142 // Requests audio focus to Android using |j_media_session_|. |
| 143 // Returns whether the request was granted. If |j_media_session_| is null, it | 143 // Returns whether the request was granted. If |j_media_session_| is null, it |
| 144 // will always return true. | 144 // will always return true. |
| 145 bool RequestSystemAudioFocus(Type type); | 145 bool RequestSystemAudioFocus(Type type); |
| 146 | 146 |
| 147 // To be called after a call to AbandonAudioFocus() in order to call the Java | 147 // To be called after a call to AbandonAudioFocus() in order to call the Java |
| 148 // MediaSession if the audio focus really need to be abandoned. | 148 // MediaSession if the audio focus really need to be abandoned. |
| 149 void AbandonSystemAudioFocusIfNeeded(); | 149 void AbandonSystemAudioFocusIfNeeded(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 163 Type audio_focus_type_; | 163 Type audio_focus_type_; |
| 164 | 164 |
| 165 MediaSessionUmaHelper uma_helper_; | 165 MediaSessionUmaHelper uma_helper_; |
| 166 | 166 |
| 167 DISALLOW_COPY_AND_ASSIGN(MediaSession); | 167 DISALLOW_COPY_AND_ASSIGN(MediaSession); |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 } // namespace content | 170 } // namespace content |
| 171 | 171 |
| 172 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_H_ | 172 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_SESSION_H_ |
| OLD | NEW |