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 #include "media/base/android/media_player_bridge.h" | 5 #include "media/base/android/media_player_bridge.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 if (j_media_player_.is_null()) { | 175 if (j_media_player_.is_null()) { |
176 pending_play_ = false; | 176 pending_play_ = false; |
177 } else { | 177 } else { |
178 if (prepared_ && IsPlaying()) | 178 if (prepared_ && IsPlaying()) |
179 PauseInternal(); | 179 PauseInternal(); |
180 else | 180 else |
181 pending_play_ = false; | 181 pending_play_ = false; |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 | |
186 bool MediaPlayerBridge::IsPlaying() { | 185 bool MediaPlayerBridge::IsPlaying() { |
187 if (!prepared_) | 186 if (!prepared_) |
188 return pending_play_; | 187 return pending_play_; |
189 | 188 |
190 JNIEnv* env = AttachCurrentThread(); | 189 JNIEnv* env = AttachCurrentThread(); |
191 CHECK(env); | 190 CHECK(env); |
192 | 191 |
193 jmethodID method = GetMethodID(env, j_media_player_class_, "isPlaying", | 192 jmethodID method = GetMethodID(env, j_media_player_class_, "isPlaying", |
194 "()Z"); | 193 "()Z"); |
195 jboolean result = env->CallBooleanMethod(j_media_player_.obj(), method); | 194 jboolean result = env->CallBooleanMethod(j_media_player_.obj(), method); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 return j_result; | 408 return j_result; |
410 } | 409 } |
411 | 410 |
412 bool MediaPlayerBridge::RegisterMediaPlayerBridge(JNIEnv* env) { | 411 bool MediaPlayerBridge::RegisterMediaPlayerBridge(JNIEnv* env) { |
413 bool ret = RegisterNativesImpl(env); | 412 bool ret = RegisterNativesImpl(env); |
414 DCHECK(g_MediaPlayerBridge_clazz); | 413 DCHECK(g_MediaPlayerBridge_clazz); |
415 return ret; | 414 return ret; |
416 } | 415 } |
417 | 416 |
418 } // namespace media | 417 } // namespace media |
OLD | NEW |