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 "content/browser/android/content_video_view.h" | 5 #include "content/browser/android/content_video_view.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "content/browser/android/content_view_core_impl.h" | 9 #include "content/browser/android/content_view_core_impl.h" |
10 #include "content/browser/media/android/browser_media_player_manager.h" | 10 #include "content/browser/media/android/browser_media_player_manager.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 192 } |
193 | 193 |
194 ScopedJavaLocalRef<jobject> ContentVideoView::GetJavaObject(JNIEnv* env) { | 194 ScopedJavaLocalRef<jobject> ContentVideoView::GetJavaObject(JNIEnv* env) { |
195 return j_content_video_view_.get(env); | 195 return j_content_video_view_.get(env); |
196 } | 196 } |
197 | 197 |
198 JavaObjectWeakGlobalRef ContentVideoView::CreateJavaObject() { | 198 JavaObjectWeakGlobalRef ContentVideoView::CreateJavaObject() { |
199 ContentViewCoreImpl* content_view_core = manager_->GetContentViewCore(); | 199 ContentViewCoreImpl* content_view_core = manager_->GetContentViewCore(); |
200 JNIEnv *env = AttachCurrentThread(); | 200 JNIEnv *env = AttachCurrentThread(); |
201 return JavaObjectWeakGlobalRef( | 201 return JavaObjectWeakGlobalRef( |
202 env, | 202 env, |
203 Java_ContentVideoView_createContentVideoView( | 203 Java_ContentVideoView_createContentVideoView( |
204 env, | 204 env, |
205 content_view_core->GetContext().obj(), | 205 content_view_core->GetContext().obj(), |
206 reinterpret_cast<intptr_t>(this), | 206 reinterpret_cast<intptr_t>(this), |
207 content_view_core->GetContentVideoViewClient().obj()).obj()); | 207 content_view_core->GetContentVideoViewClient().obj()).obj()); |
208 } | 208 } |
209 | 209 |
210 void ContentVideoView::DestroyContentVideoView(bool native_view_destroyed) { | 210 void ContentVideoView::DestroyContentVideoView(bool native_view_destroyed) { |
211 JNIEnv *env = AttachCurrentThread(); | 211 JNIEnv *env = AttachCurrentThread(); |
212 ScopedJavaLocalRef<jobject> content_video_view = GetJavaObject(env); | 212 ScopedJavaLocalRef<jobject> content_video_view = GetJavaObject(env); |
213 if (!content_video_view.is_null()) { | 213 if (!content_video_view.is_null()) { |
214 Java_ContentVideoView_destroyContentVideoView(env, | 214 Java_ContentVideoView_destroyContentVideoView(env, |
215 content_video_view.obj(), native_view_destroyed); | 215 content_video_view.obj(), native_view_destroyed); |
216 j_content_video_view_.reset(); | 216 j_content_video_view_.reset(); |
217 } | 217 } |
218 } | 218 } |
219 } // namespace content | 219 } // namespace content |
OLD | NEW |