| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 if (obj.is_null()) | 692 if (obj.is_null()) |
| 693 return; | 693 return; |
| 694 Java_ContentViewCore_showPastePopup(env, obj.obj(), | 694 Java_ContentViewCore_showPastePopup(env, obj.obj(), |
| 695 static_cast<jint>(x_dip), | 695 static_cast<jint>(x_dip), |
| 696 static_cast<jint>(y_dip)); | 696 static_cast<jint>(y_dip)); |
| 697 } | 697 } |
| 698 | 698 |
| 699 void ContentViewCoreImpl::GetScaledContentBitmap( | 699 void ContentViewCoreImpl::GetScaledContentBitmap( |
| 700 float scale, | 700 float scale, |
| 701 jobject jbitmap_config, | 701 jobject jbitmap_config, |
| 702 gfx::Rect src_subrect, |
| 702 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { | 703 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { |
| 703 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 704 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| 704 if (!view) { | 705 if (!view) { |
| 705 result_callback.Run(false, SkBitmap()); | 706 result_callback.Run(false, SkBitmap()); |
| 706 return; | 707 return; |
| 707 } | 708 } |
| 708 SkBitmap::Config skbitmap_format = gfx::ConvertToSkiaConfig(jbitmap_config); | 709 SkBitmap::Config skbitmap_format = gfx::ConvertToSkiaConfig(jbitmap_config); |
| 709 view->GetScaledContentBitmap(scale, skbitmap_format, result_callback); | 710 view->GetScaledContentBitmap(scale, skbitmap_format, src_subrect, |
| 711 result_callback); |
| 710 } | 712 } |
| 711 | 713 |
| 712 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { | 714 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { |
| 713 JNIEnv* env = AttachCurrentThread(); | 715 JNIEnv* env = AttachCurrentThread(); |
| 714 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 716 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 715 if (j_obj.is_null()) | 717 if (j_obj.is_null()) |
| 716 return; | 718 return; |
| 717 ScopedJavaLocalRef<jstring> jcontent_url = | 719 ScopedJavaLocalRef<jstring> jcontent_url = |
| 718 ConvertUTF8ToJavaString(env, content_url.spec()); | 720 ConvertUTF8ToJavaString(env, content_url.spec()); |
| 719 Java_ContentViewCore_startContentIntent(env, | 721 Java_ContentViewCore_startContentIntent(env, |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1453 | 1455 |
| 1454 jboolean ContentViewCoreImpl::OnAnimate(JNIEnv* env, jobject /* obj */, | 1456 jboolean ContentViewCoreImpl::OnAnimate(JNIEnv* env, jobject /* obj */, |
| 1455 jlong frame_time_micros) { | 1457 jlong frame_time_micros) { |
| 1456 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 1458 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| 1457 if (!view) | 1459 if (!view) |
| 1458 return false; | 1460 return false; |
| 1459 | 1461 |
| 1460 return view->Animate(base::TimeTicks::FromInternalValue(frame_time_micros)); | 1462 return view->Animate(base::TimeTicks::FromInternalValue(frame_time_micros)); |
| 1461 } | 1463 } |
| 1462 | 1464 |
| 1463 jboolean ContentViewCoreImpl::PopulateBitmapFromCompositor(JNIEnv* env, | |
| 1464 jobject obj, | |
| 1465 jobject jbitmap) { | |
| 1466 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | |
| 1467 if (!view) | |
| 1468 return false; | |
| 1469 | |
| 1470 return view->PopulateBitmapWithContents(jbitmap); | |
| 1471 } | |
| 1472 | |
| 1473 void ContentViewCoreImpl::WasResized(JNIEnv* env, jobject obj) { | 1465 void ContentViewCoreImpl::WasResized(JNIEnv* env, jobject obj) { |
| 1474 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 1466 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| 1475 if (view) | 1467 if (view) |
| 1476 view->WasResized(); | 1468 view->WasResized(); |
| 1477 } | 1469 } |
| 1478 | 1470 |
| 1479 void ContentViewCoreImpl::ShowInterstitialPage( | 1471 void ContentViewCoreImpl::ShowInterstitialPage( |
| 1480 JNIEnv* env, jobject obj, jstring jurl, jint delegate_ptr) { | 1472 JNIEnv* env, jobject obj, jstring jurl, jint delegate_ptr) { |
| 1481 GURL url(base::android::ConvertJavaStringToUTF8(env, jurl)); | 1473 GURL url(base::android::ConvertJavaStringToUTF8(env, jurl)); |
| 1482 InterstitialPageDelegateAndroid* delegate = | 1474 InterstitialPageDelegateAndroid* delegate = |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1825 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1834 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1826 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1835 return reinterpret_cast<intptr_t>(view); | 1827 return reinterpret_cast<intptr_t>(view); |
| 1836 } | 1828 } |
| 1837 | 1829 |
| 1838 bool RegisterContentViewCore(JNIEnv* env) { | 1830 bool RegisterContentViewCore(JNIEnv* env) { |
| 1839 return RegisterNativesImpl(env); | 1831 return RegisterNativesImpl(env); |
| 1840 } | 1832 } |
| 1841 | 1833 |
| 1842 } // namespace content | 1834 } // namespace content |
| OLD | NEW |