| 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_MEDIA_ANDROID_AUDIO_FOCUS_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_ANDROID_AUDIO_FOCUS_MANAGER_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" |
| 13 |
| 14 namespace base { |
| 15 class SingleThreadTaskRunner; |
| 16 } |
| 17 |
| 18 namespace content { |
| 19 class BrowserMediaPlayerManager; |
| 20 |
| 21 class AudioFocusManager { |
| 22 public: |
| 23 AudioFocusManager( |
| 24 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 25 base::WeakPtr<BrowserMediaPlayerManager> manager); |
| 26 ~AudioFocusManager(); |
| 27 |
| 28 static bool RegisterAudioFocusManager(JNIEnv* env); |
| 29 |
| 30 // Called by AudioFocusManager.java. |
| 31 void OnMediaInterrupted(JNIEnv*, jobject, jint player_id); |
| 32 |
| 33 // Called by browser_media_player_manager.cc |
| 34 void RequestAudioFocus(int player_id); |
| 35 void AbandonAudioFocus(int player_id); |
| 36 |
| 37 private: |
| 38 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 39 |
| 40 base::WeakPtr<BrowserMediaPlayerManager> manager_; |
| 41 |
| 42 base::android::ScopedJavaGlobalRef<jobject> j_audio_focus_manager_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(AudioFocusManager); |
| 45 }; |
| 46 |
| 47 } // namespace content |
| 48 |
| 49 #endif // CONTENT_BROWSER_MEDIA_ANDROID_AUDIO_FOCUS_MANAGER_H_ |
| OLD | NEW |