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

Unified Diff: content/browser/media/session/media_session_android.h

Issue 2439483003: Link MediaSessionTabHelper with native MediaSession [CL is going to be split] (Closed)
Patch Set: Don't review, this CL is getting huge and needs to be split Created 4 years, 2 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/session/media_session_android.h
diff --git a/content/browser/media/session/media_session_android.h b/content/browser/media/session/media_session_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..cd15e017aa0d6039c37b7b2b4c6765a4640eedaf
--- /dev/null
+++ b/content/browser/media/session/media_session_android.h
@@ -0,0 +1,53 @@
+// Copyright 2016 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_SESSION_MEDIA_SESSION_ANDROID_H_
+#define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_ANDROID_H_
+
+#include <memory>
+#include <vector>
+
+#include "base/android/scoped_java_ref.h"
+#include "content/browser/media/session/media_session.h"
+#include "content/browser/media/session/media_session_observer.h"
+
+namespace content {
+
+class MediaSession;
+
+// This class is interlayer between native MediaSession and Java
+// ChromeMediaSession. This class is owned by the native MediaSession and will
+// teardown Java ChromeMediaSession when the native MediaSession is destroyed.
+// Java MediaSessionObservers are also proxied via this class.
+class MediaSessionAndroid final : public MediaSessionObserver {
+ public:
+ MediaSessionAndroid(MediaSession* session);
+ ~MediaSessionAndroid() override;
+
+ static bool Register(JNIEnv* env);
+
+ base::android::ScopedJavaLocalRef<jobject> GetJavaSession();
+
+ // MediaSessionObserver implementation.
+ void MediaSessionDestroyed() override;
+ void MediaSessionStateChanged(bool is_controllable,
+ bool is_suspended) override;
+ void MediaSessionMetadataChanged(
+ const base::Optional<MediaMetadata>& metadata) override;
+
+ // MediaSession method wrappers.
+ void Resume(JNIEnv* env, const base::android::JavaParamRef<jobject>& j_obj);
+ void Suspend(JNIEnv* env, const base::android::JavaParamRef<jobject>& j_obj);
+ void Stop(JNIEnv* env, const base::android::JavaParamRef<jobject>& j_obj);
+
+ private:
+ // The linked Java object
+ base::android::ScopedJavaGlobalRef<jobject> j_media_session_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaSessionAndroid);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_ANDROID_H_
« no previous file with comments | « content/browser/media/session/media_session.cc ('k') | content/browser/media/session/media_session_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698