OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "chrome/browser/media/android/remote/remote_media_player_bridge.h" | 5 #include "chrome/browser/media/android/remote/remote_media_player_bridge.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
9 #include "chrome/browser/media/android/remote/record_cast_action.h" | 11 #include "chrome/browser/media/android/remote/record_cast_action.h" |
10 #include "chrome/browser/media/android/remote/remote_media_player_manager.h" | 12 #include "chrome/browser/media/android/remote/remote_media_player_manager.h" |
11 #include "content/public/browser/android/content_view_core.h" | 13 #include "content/public/browser/android/content_view_core.h" |
12 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
13 #include "jni/RemoteMediaPlayerBridge_jni.h" | 15 #include "jni/RemoteMediaPlayerBridge_jni.h" |
14 #include "media/base/android/media_common_android.h" | 16 #include "media/base/android/media_common_android.h" |
15 #include "media/base/android/media_resource_getter.h" | 17 #include "media/base/android/media_resource_getter.h" |
16 #include "media/base/timestamp_constants.h" | 18 #include "media/base/timestamp_constants.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 Java_RemoteMediaPlayerBridge_pause(env, java_bridge_.obj()); | 165 Java_RemoteMediaPlayerBridge_pause(env, java_bridge_.obj()); |
164 time_update_timer_.Stop(); | 166 time_update_timer_.Stop(); |
165 } | 167 } |
166 } | 168 } |
167 | 169 |
168 void RemoteMediaPlayerBridge::SetVideoSurface(gfx::ScopedJavaSurface surface) { | 170 void RemoteMediaPlayerBridge::SetVideoSurface(gfx::ScopedJavaSurface surface) { |
169 // The surface is reset whenever the fullscreen view is destroyed or created. | 171 // The surface is reset whenever the fullscreen view is destroyed or created. |
170 // Since the remote player doesn't use it, we forward it to the local player | 172 // Since the remote player doesn't use it, we forward it to the local player |
171 // for the time when user disconnects and resumes local playback | 173 // for the time when user disconnects and resumes local playback |
172 // (see crbug.com/420690). | 174 // (see crbug.com/420690). |
173 local_player_->SetVideoSurface(surface.Pass()); | 175 local_player_->SetVideoSurface(std::move(surface)); |
174 } | 176 } |
175 | 177 |
176 base::android::ScopedJavaLocalRef<jstring> RemoteMediaPlayerBridge::GetFrameUrl( | 178 base::android::ScopedJavaLocalRef<jstring> RemoteMediaPlayerBridge::GetFrameUrl( |
177 JNIEnv* env, | 179 JNIEnv* env, |
178 const JavaParamRef<jobject>& obj) { | 180 const JavaParamRef<jobject>& obj) { |
179 return ConvertUTF8ToJavaString(env, frame_url().spec()); | 181 return ConvertUTF8ToJavaString(env, frame_url().spec()); |
180 } | 182 } |
181 | 183 |
182 void RemoteMediaPlayerBridge::OnPlaying(JNIEnv* env, | 184 void RemoteMediaPlayerBridge::OnPlaying(JNIEnv* env, |
183 const JavaParamRef<jobject>& obj) { | 185 const JavaParamRef<jobject>& obj) { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 // TODO(aberent) Do we need to retrieve auth credentials for basic | 403 // TODO(aberent) Do we need to retrieve auth credentials for basic |
402 // authentication? MediaPlayerBridge does. | 404 // authentication? MediaPlayerBridge does. |
403 cookies_ = cookies; | 405 cookies_ = cookies; |
404 JNIEnv* env = AttachCurrentThread(); | 406 JNIEnv* env = AttachCurrentThread(); |
405 CHECK(env); | 407 CHECK(env); |
406 Java_RemoteMediaPlayerBridge_setCookies( | 408 Java_RemoteMediaPlayerBridge_setCookies( |
407 env, java_bridge_.obj(), ConvertUTF8ToJavaString(env, cookies).obj()); | 409 env, java_bridge_.obj(), ConvertUTF8ToJavaString(env, cookies).obj()); |
408 } | 410 } |
409 | 411 |
410 } // namespace remote_media | 412 } // namespace remote_media |
OLD | NEW |