Chromium Code Reviews| 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_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 692 | 692 |
| 693 void ContentViewCoreImpl::SetVSyncNotificationEnabled(bool enabled) { | 693 void ContentViewCoreImpl::SetVSyncNotificationEnabled(bool enabled) { |
| 694 JNIEnv* env = AttachCurrentThread(); | 694 JNIEnv* env = AttachCurrentThread(); |
| 695 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 695 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 696 if (obj.is_null()) | 696 if (obj.is_null()) |
| 697 return; | 697 return; |
| 698 Java_ContentViewCore_setVSyncNotificationEnabled( | 698 Java_ContentViewCore_setVSyncNotificationEnabled( |
| 699 env, obj.obj(), static_cast<jboolean>(enabled)); | 699 env, obj.obj(), static_cast<jboolean>(enabled)); |
| 700 } | 700 } |
| 701 | 701 |
| 702 void ContentViewCoreImpl::SetNeedsAnimate() { | |
| 703 JNIEnv* env = AttachCurrentThread(); | |
| 704 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 705 if (obj.is_null()) | |
| 706 return; | |
| 707 Java_ContentViewCore_setNeedsAnimate(env, obj.obj()); | |
| 708 } | |
| 709 | |
| 702 ui::ViewAndroid* ContentViewCoreImpl::GetViewAndroid() const { | 710 ui::ViewAndroid* ContentViewCoreImpl::GetViewAndroid() const { |
| 703 // view_android_ should never be null for Chrome. | 711 // view_android_ should never be null for Chrome. |
| 704 DCHECK(view_android_); | 712 DCHECK(view_android_); |
| 705 return view_android_; | 713 return view_android_; |
| 706 } | 714 } |
| 707 | 715 |
| 708 ui::WindowAndroid* ContentViewCoreImpl::GetWindowAndroid() const { | 716 ui::WindowAndroid* ContentViewCoreImpl::GetWindowAndroid() const { |
| 709 // This should never be NULL for Chrome, but will be NULL for WebView. | 717 // This should never be NULL for Chrome, but will be NULL for WebView. |
| 710 DCHECK(window_android_); | 718 DCHECK(window_android_); |
| 711 return window_android_; | 719 return window_android_; |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1216 | 1224 |
| 1217 void ContentViewCoreImpl::OnVSync(JNIEnv* env, jobject /* obj */, | 1225 void ContentViewCoreImpl::OnVSync(JNIEnv* env, jobject /* obj */, |
| 1218 jlong frame_time_micros) { | 1226 jlong frame_time_micros) { |
| 1219 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 1227 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| 1220 if (!view) | 1228 if (!view) |
| 1221 return; | 1229 return; |
| 1222 | 1230 |
| 1223 view->SendVSync(base::TimeTicks::FromInternalValue(frame_time_micros)); | 1231 view->SendVSync(base::TimeTicks::FromInternalValue(frame_time_micros)); |
| 1224 } | 1232 } |
| 1225 | 1233 |
| 1234 void ContentViewCoreImpl::Animate(JNIEnv* env, jobject /* obj */, | |
| 1235 jlong frame_time_micros) { | |
| 1236 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | |
| 1237 if (!view) | |
| 1238 return; | |
| 1239 | |
| 1240 view->Animate(base::TimeTicks::FromInternalValue(frame_time_micros)); | |
| 1241 } | |
| 1242 | |
| 1226 jboolean ContentViewCoreImpl::PopulateBitmapFromCompositor(JNIEnv* env, | 1243 jboolean ContentViewCoreImpl::PopulateBitmapFromCompositor(JNIEnv* env, |
| 1227 jobject obj, | 1244 jobject obj, |
| 1228 jobject jbitmap) { | 1245 jobject jbitmap) { |
| 1229 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 1246 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| 1230 if (!view) | 1247 if (!view) |
| 1231 return false; | 1248 return false; |
| 1232 | 1249 |
| 1233 return view->PopulateBitmapWithContents(jbitmap); | 1250 return view->PopulateBitmapWithContents(jbitmap); |
| 1234 } | 1251 } |
| 1235 | 1252 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1275 #if defined(GOOGLE_TV) | 1292 #if defined(GOOGLE_TV) |
| 1276 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 1293 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
| 1277 web_contents_->GetRenderViewHost()); | 1294 web_contents_->GetRenderViewHost()); |
| 1278 if (rvhi && rvhi->media_player_manager()) { | 1295 if (rvhi && rvhi->media_player_manager()) { |
| 1279 rvhi->media_player_manager()->DetachExternalVideoSurface( | 1296 rvhi->media_player_manager()->DetachExternalVideoSurface( |
| 1280 static_cast<int>(player_id)); | 1297 static_cast<int>(player_id)); |
| 1281 } | 1298 } |
| 1282 #endif | 1299 #endif |
| 1283 } | 1300 } |
| 1284 | 1301 |
| 1302 | |
|
aelias_OOO_until_Jul13
2013/05/10 04:37:07
Nit: accidental whitespace
jdduke (slow)
2013/05/10 16:39:52
Oops, fixed.
| |
| 1303 | |
| 1285 jboolean ContentViewCoreImpl::IsRenderWidgetHostViewReady(JNIEnv* env, | 1304 jboolean ContentViewCoreImpl::IsRenderWidgetHostViewReady(JNIEnv* env, |
| 1286 jobject obj) { | 1305 jobject obj) { |
| 1287 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 1306 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| 1288 return view && view->HasValidFrame(); | 1307 return view && view->HasValidFrame(); |
| 1289 } | 1308 } |
| 1290 | 1309 |
| 1291 void ContentViewCoreImpl::ExitFullscreen(JNIEnv* env, jobject obj) { | 1310 void ContentViewCoreImpl::ExitFullscreen(JNIEnv* env, jobject obj) { |
| 1292 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 1311 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| 1293 host->ExitFullscreen(); | 1312 host->ExitFullscreen(); |
| 1294 } | 1313 } |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1529 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1548 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1530 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1549 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1531 return reinterpret_cast<jint>(view); | 1550 return reinterpret_cast<jint>(view); |
| 1532 } | 1551 } |
| 1533 | 1552 |
| 1534 bool RegisterContentViewCore(JNIEnv* env) { | 1553 bool RegisterContentViewCore(JNIEnv* env) { |
| 1535 return RegisterNativesImpl(env); | 1554 return RegisterNativesImpl(env); |
| 1536 } | 1555 } |
| 1537 | 1556 |
| 1538 } // namespace content | 1557 } // namespace content |
| OLD | NEW |