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

Unified Diff: content/browser/media/android/audio_focus_manager.h

Issue 1131793004: Migrate AudioFocusChangeListener to browser and always send GAIN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: webview suggestions from boliu Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/media/android/audio_focus_manager.h
diff --git a/content/browser/media/android/audio_focus_manager.h b/content/browser/media/android/audio_focus_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..1d72833b79422f62fafd0f799a535a4509626fcb
--- /dev/null
+++ b/content/browser/media/android/audio_focus_manager.h
@@ -0,0 +1,49 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_MEDIA_ANDROID_AUDIO_FOCUS_MANAGER_H_
+#define CONTENT_BROWSER_MEDIA_ANDROID_AUDIO_FOCUS_MANAGER_H_
+
+#include <jni.h>
+
+#include "base/android/scoped_java_ref.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace content {
+class BrowserMediaPlayerManager;
+
+class AudioFocusManager {
+ public:
+ AudioFocusManager(
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
+ base::WeakPtr<BrowserMediaPlayerManager> manager);
+ ~AudioFocusManager();
+
+ static bool RegisterAudioFocusManager(JNIEnv* env);
+
+ // Called by AudioFocusManager.java.
+ void OnMediaInterrupted(JNIEnv*, jobject, jint player_id);
+
+ // Called by browser_media_player_manager.cc
+ void RequestAudioFocus(int player_id);
+ void AbandonAudioFocus(int player_id);
+
+ private:
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+
+ base::WeakPtr<BrowserMediaPlayerManager> manager_;
+
+ base::android::ScopedJavaGlobalRef<jobject> j_audio_focus_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(AudioFocusManager);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MEDIA_ANDROID_AUDIO_FOCUS_MANAGER_H_
« no previous file with comments | « content/browser/android/browser_jni_registrar.cc ('k') | content/browser/media/android/audio_focus_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698