| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/browser/android/external_video_surface_container_impl.h" | 5 #include "chromecast/browser/android/external_video_surface_container_impl.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "content/public/browser/android/content_view_core.h" | 8 #include "content/public/browser/android/content_view_core.h" |
| 9 #include "jni/ExternalVideoSurfaceContainer_jni.h" | 9 #include "jni/ExternalVideoSurfaceContainer_jni.h" |
| 10 #include "ui/gfx/geometry/rect_f.h" | 10 #include "ui/gfx/geometry/rect_f.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 const SurfaceDestroyedCB& surface_destroyed_cb) { | 36 const SurfaceDestroyedCB& surface_destroyed_cb) { |
| 37 surface_created_cb_ = surface_created_cb; | 37 surface_created_cb_ = surface_created_cb; |
| 38 surface_destroyed_cb_ = surface_destroyed_cb; | 38 surface_destroyed_cb_ = surface_destroyed_cb; |
| 39 | 39 |
| 40 JNIEnv* env = base::android::AttachCurrentThread(); | 40 JNIEnv* env = base::android::AttachCurrentThread(); |
| 41 Java_ExternalVideoSurfaceContainer_requestExternalVideoSurface( | 41 Java_ExternalVideoSurfaceContainer_requestExternalVideoSurface( |
| 42 env, jobject_.obj(), static_cast<jint>(player_id)); | 42 env, jobject_.obj(), static_cast<jint>(player_id)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 int ExternalVideoSurfaceContainerImpl::GetCurrentPlayerId() { | 45 int ExternalVideoSurfaceContainerImpl::GetCurrentPlayerId() { |
| 46 JNIEnv* env = AttachCurrentThread(); | 46 JNIEnv* env = base::android::AttachCurrentThread(); |
| 47 | 47 |
| 48 int current_player = static_cast<int>( | 48 int current_player = static_cast<int>( |
| 49 Java_ExternalVideoSurfaceContainer_getCurrentPlayerId( | 49 Java_ExternalVideoSurfaceContainer_getCurrentPlayerId( |
| 50 env, jobject_.obj())); | 50 env, jobject_.obj())); |
| 51 | 51 |
| 52 if (current_player < 0) | 52 if (current_player < 0) |
| 53 return kInvalidPlayerId; | 53 return kInvalidPlayerId; |
| 54 else | 54 else |
| 55 return current_player; | 55 return current_player; |
| 56 } | 56 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 if (!surface_destroyed_cb_.is_null()) | 95 if (!surface_destroyed_cb_.is_null()) |
| 96 surface_destroyed_cb_.Run(static_cast<int>(player_id)); | 96 surface_destroyed_cb_.Run(static_cast<int>(player_id)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool RegisterExternalVideoSurfaceContainer(JNIEnv* env) { | 99 bool RegisterExternalVideoSurfaceContainer(JNIEnv* env) { |
| 100 return RegisterNativesImpl(env); | 100 return RegisterNativesImpl(env); |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace shell | 103 } // namespace shell |
| 104 } // namespace chromecast | 104 } // namespace chromecast |
| OLD | NEW |