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

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

Issue 2439483003: Link MediaSessionTabHelper with native MediaSession [CL is going to be split] (Closed)
Patch Set: addressed nits 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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_SESSION_MEDIA_SESSION_DELEGATE_ANDROID_H_
6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_DELEGATE_ANDROID_H_
7
8 #include <jni.h>
9
10 #include "base/android/jni_weak_ref.h"
11 #include "content/browser/media/session/media_session_observer.h"
12
13 namespace content {
14
15 // The class for listening to MediaSession messages and perform actions on the
16 // MediaSession. This method is the native counterpart of Java
whywhat 2016/10/20 22:56:53 s/method/class
Zhiqiang Zhang (Slow) 2016/10/21 13:43:52 Done.
17 // MediaSessionDelegate. A native object its linked Java object must notify each
whywhat 2016/10/20 22:56:53 s/A native object its linked/The native and the/
Zhiqiang Zhang (Slow) 2016/10/21 13:43:52 Done.
18 // other when any of them is destroyed.
19 class MediaSessionDelegateAndroid : public MediaSessionObserver {
20 public:
21 static bool Register(JNIEnv* env);
22
23 // Create a native MediaSessionDelegate object, start observe |media_session|,
24 // and link it to the |j_delegate| (its Java counterpart).
25 static void CreateAndConnect(
26 MediaSession* media_session,
27 JNIEnv* env,
28 const base::android::JavaParamRef<jobject>& j_delegate);
29
30 ~MediaSessionDelegateAndroid() override;
31
32 // MediaSessionObserver implementations
33 void MediaSessionDisconnected() override;
34 void MediaSessionStateChanged(bool is_controllable,
35 bool is_suspended) override;
36 void MediaSessionMetadataChanged(
37 const base::Optional<MediaMetadata>& metadata) override;
38
39 // Resume the connected MediaSession.
40 void ResumeMediaSession(JNIEnv* env,
41 const base::android::JavaParamRef<jobject>& obj);
42 // Suspend the connected MediaSession.
43 void SuspendMediaSession(JNIEnv* env,
44 const base::android::JavaParamRef<jobject>& obj);
45 // Stop the connected MediaSession.
46 void StopMediaSession(JNIEnv* env,
47 const base::android::JavaParamRef<jobject>& obj);
48 // Disconnect the connected MediaSession.
49 void DisconnectMediaSession(JNIEnv* env,
50 const base::android::JavaParamRef<jobject>& obj);
51
52 private:
53 // Create a MediaSessionDelegateAndroid object and start observing
54 // |media_session|. Does not tell |j_delegate| to connect this object.
55 MediaSessionDelegateAndroid(
56 MediaSession* media_session,
57 JNIEnv* env,
58 const base::android::JavaParamRef<jobject>& j_delegate);
59
60 // The linked Java counterpart.
61 JavaObjectWeakGlobalRef j_delegate_;
62
63 DISALLOW_COPY_AND_ASSIGN(MediaSessionDelegateAndroid);
64 };
65
66 } // namespace content
67
68 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_DELEGATE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698