| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 SetVolume(volume_); | 102 SetVolume(volume_); |
| 103 | 103 |
| 104 AttachListener(j_media_player_bridge_.obj()); | 104 AttachListener(j_media_player_bridge_.obj()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void MediaPlayerBridge::SetDuration(base::TimeDelta duration) { | 107 void MediaPlayerBridge::SetDuration(base::TimeDelta duration) { |
| 108 duration_ = duration; | 108 duration_ = duration; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void MediaPlayerBridge::SetVideoSurface(gfx::ScopedJavaSurface surface) { | 111 void MediaPlayerBridge::SetVideoSurface(gfx::ScopedJavaSurface surface) { |
| 112 if (j_media_player_bridge_.is_null()) { | 112 surface_ = surface.Pass(); |
| 113 if (!surface.IsEmpty()) | 113 |
| 114 surface_ = surface.Pass(); | 114 if (j_media_player_bridge_.is_null()) |
| 115 return; | 115 return; |
| 116 } | |
| 117 | 116 |
| 118 JNIEnv* env = base::android::AttachCurrentThread(); | 117 JNIEnv* env = base::android::AttachCurrentThread(); |
| 119 CHECK(env); | 118 CHECK(env); |
| 120 | 119 |
| 121 Java_MediaPlayerBridge_setSurface( | 120 Java_MediaPlayerBridge_setSurface( |
| 122 env, j_media_player_bridge_.obj(), surface.j_surface().obj()); | 121 env, j_media_player_bridge_.obj(), surface_.j_surface().obj()); |
| 123 } | 122 } |
| 124 | 123 |
| 125 void MediaPlayerBridge::Prepare() { | 124 void MediaPlayerBridge::Prepare() { |
| 126 DCHECK(j_media_player_bridge_.is_null()); | 125 DCHECK(j_media_player_bridge_.is_null()); |
| 127 CreateJavaMediaPlayerBridge(); | 126 CreateJavaMediaPlayerBridge(); |
| 128 if (url_.SchemeIsFileSystem() || url_.SchemeIsBlob()) { | 127 if (url_.SchemeIsFileSystem() || url_.SchemeIsBlob()) { |
| 129 manager()->GetMediaResourceGetter()->GetPlatformPathFromURL( | 128 manager()->GetMediaResourceGetter()->GetPlatformPathFromURL( |
| 130 url_, | 129 url_, |
| 131 base::Bind(&MediaPlayerBridge::SetDataSource, | 130 base::Bind(&MediaPlayerBridge::SetDataSource, |
| 132 weak_factory_.GetWeakPtr())); | 131 weak_factory_.GetWeakPtr())); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 527 |
| 529 GURL MediaPlayerBridge::GetUrl() { | 528 GURL MediaPlayerBridge::GetUrl() { |
| 530 return url_; | 529 return url_; |
| 531 } | 530 } |
| 532 | 531 |
| 533 GURL MediaPlayerBridge::GetFirstPartyForCookies() { | 532 GURL MediaPlayerBridge::GetFirstPartyForCookies() { |
| 534 return first_party_for_cookies_; | 533 return first_party_for_cookies_; |
| 535 } | 534 } |
| 536 | 535 |
| 537 } // namespace media | 536 } // namespace media |
| OLD | NEW |