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

Side by Side Diff: content/browser/media/session/media_session_android.h

Issue 2453623003: Decouple MediaSession messages from WebContents (full patch) (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
Zhiqiang Zhang (Slow) 2016/10/26 12:50:37 This is a hybrid of "WebContentsAndroid & WebConte
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_SESSION_MEDIA_SESSION_ANDROID_H_
6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_ANDROID_H_
7
8 #include <jni.h>
9 #include <memory>
10 #include <vector>
11
12 #include "base/android/scoped_java_ref.h"
13 #include "content/public/browser/media_session_observer.h"
14
15 namespace content {
16
17 class MediaSessionImpl;
18
19 bool RegisterMediaSessionNatives(JNIEnv* env);
20
21 // This class is interlayer between native MediaSession and Java
22 // MediaSession. This class is owned by the native MediaSession and will
23 // teardown Java MediaSession when the native MediaSession is destroyed.
24 // Java MediaSessionObservers are also proxied via this class.
25 class MediaSessionAndroid final : public MediaSessionObserver {
26 public:
27 MediaSessionAndroid(MediaSession* session);
jam 2016/10/26 17:30:59 nit: explicit
Zhiqiang Zhang (Slow) 2016/10/26 18:44:25 Done in the splitted CL.
28 ~MediaSessionAndroid() override;
29
30 static bool Register(JNIEnv* env);
31
32 base::android::ScopedJavaLocalRef<jobject> GetJavaSession();
33
34 // MediaSessionObserver implementation.
35 void MediaSessionDestroyed() override;
36 void MediaSessionStateChanged(bool is_controllable,
37 bool is_suspended) override;
38 void MediaSessionMetadataChanged(
39 const base::Optional<MediaMetadata>& metadata) override;
40
41 // MediaSession method wrappers.
42 void Resume(JNIEnv* env, const base::android::JavaParamRef<jobject>& j_obj);
43 void Suspend(JNIEnv* env, const base::android::JavaParamRef<jobject>& j_obj);
44 void Stop(JNIEnv* env, const base::android::JavaParamRef<jobject>& j_obj);
45
46 private:
47 // The linked Java object
48 base::android::ScopedJavaGlobalRef<jobject> j_media_session_;
49
50 DISALLOW_COPY_AND_ASSIGN(MediaSessionAndroid);
51 };
52
53 } // namespace content
54
55 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698