OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_LISTENER_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_LISTENER_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_LISTENER_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_LISTENER_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void OnMediaPrepared(JNIEnv* /* env */, | 52 void OnMediaPrepared(JNIEnv* /* env */, |
53 const base::android::JavaParamRef<jobject>& /* obj */); | 53 const base::android::JavaParamRef<jobject>& /* obj */); |
54 void OnMediaInterrupted( | 54 void OnMediaInterrupted( |
55 JNIEnv* /* env */, | 55 JNIEnv* /* env */, |
56 const base::android::JavaParamRef<jobject>& /* obj */); | 56 const base::android::JavaParamRef<jobject>& /* obj */); |
57 | 57 |
58 // Create a Java MediaPlayerListener object and listens to all the media | 58 // Create a Java MediaPlayerListener object and listens to all the media |
59 // related events from system and |media_player|. If |media_player| is NULL, | 59 // related events from system and |media_player|. If |media_player| is NULL, |
60 // this class only listens to system events. | 60 // this class only listens to system events. |
61 void CreateMediaPlayerListener( | 61 void CreateMediaPlayerListener( |
62 const base::android::JavaRef<jobject>& context, | |
63 const base::android::JavaRef<jobject>& media_player); | 62 const base::android::JavaRef<jobject>& media_player); |
64 void ReleaseMediaPlayerListenerResources(); | 63 void ReleaseMediaPlayerListenerResources(); |
65 | 64 |
66 // Register MediaPlayerListener in the system library loader. | 65 // Register MediaPlayerListener in the system library loader. |
67 static bool RegisterMediaPlayerListener(JNIEnv* env); | 66 static bool RegisterMediaPlayerListener(JNIEnv* env); |
68 | 67 |
69 private: | 68 private: |
70 // The message loop where |media_player_| lives. | 69 // The message loop where |media_player_| lives. |
71 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 70 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
72 | 71 |
73 // The MediaPlayerAndroid object all the callbacks should be sent to. | 72 // The MediaPlayerAndroid object all the callbacks should be sent to. |
74 base::WeakPtr<MediaPlayerAndroid> media_player_; | 73 base::WeakPtr<MediaPlayerAndroid> media_player_; |
75 | 74 |
76 base::android::ScopedJavaGlobalRef<jobject> j_media_player_listener_; | 75 base::android::ScopedJavaGlobalRef<jobject> j_media_player_listener_; |
77 | 76 |
78 DISALLOW_COPY_AND_ASSIGN(MediaPlayerListener); | 77 DISALLOW_COPY_AND_ASSIGN(MediaPlayerListener); |
79 }; | 78 }; |
80 | 79 |
81 } // namespace media | 80 } // namespace media |
82 | 81 |
83 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_LISTENER_H_ | 82 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_LISTENER_H_ |
OLD | NEW |