OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_ANDROID_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 | 12 |
| 13 #include "base/android/scoped_java_ref.h" |
13 #include "base/callback.h" | 14 #include "base/callback.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
17 #include "media/base/android/media_player_listener.h" | 18 #include "media/base/android/media_player_listener.h" |
18 #include "media/base/media_export.h" | 19 #include "media/base/media_export.h" |
19 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
20 #include "ui/gl/android/scoped_java_surface.h" | 21 #include "ui/gl/android/scoped_java_surface.h" |
21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
22 | 23 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 122 |
122 int player_id() { return player_id_; } | 123 int player_id() { return player_id_; } |
123 | 124 |
124 GURL frame_url() { return frame_url_; } | 125 GURL frame_url() { return frame_url_; } |
125 | 126 |
126 int media_session_id() { return media_session_id_; } | 127 int media_session_id() { return media_session_id_; } |
127 | 128 |
128 // Attach/Detaches |listener_| for listening to all the media events. If | 129 // Attach/Detaches |listener_| for listening to all the media events. If |
129 // |j_media_player| is NULL, |listener_| only listens to the system media | 130 // |j_media_player| is NULL, |listener_| only listens to the system media |
130 // events. Otherwise, it also listens to the events from |j_media_player|. | 131 // events. Otherwise, it also listens to the events from |j_media_player|. |
131 void AttachListener(jobject j_media_player); | 132 void AttachListener(const base::android::JavaRef<jobject>& j_media_player); |
132 void DetachListener(); | 133 void DetachListener(); |
133 | 134 |
134 protected: | 135 protected: |
135 MediaPlayerAndroid( | 136 MediaPlayerAndroid( |
136 int player_id, | 137 int player_id, |
137 MediaPlayerManager* manager, | 138 MediaPlayerManager* manager, |
138 const OnDecoderResourcesReleasedCB& on_decoder_resources_released_cb, | 139 const OnDecoderResourcesReleasedCB& on_decoder_resources_released_cb, |
139 const GURL& frame_url, | 140 const GURL& frame_url, |
140 int media_session_id); | 141 int media_session_id); |
141 | 142 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // Weak pointer passed to |listener_| for callbacks. | 198 // Weak pointer passed to |listener_| for callbacks. |
198 // NOTE: Weak pointers must be invalidated before all other member variables. | 199 // NOTE: Weak pointers must be invalidated before all other member variables. |
199 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; | 200 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; |
200 | 201 |
201 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); | 202 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); |
202 }; | 203 }; |
203 | 204 |
204 } // namespace media | 205 } // namespace media |
205 | 206 |
206 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 207 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
OLD | NEW |