| 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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 if (obj.is_null()) | 684 if (obj.is_null()) |
| 685 return; | 685 return; |
| 686 Java_ContentViewCore_showPastePopup(env, obj.obj(), | 686 Java_ContentViewCore_showPastePopup(env, obj.obj(), |
| 687 static_cast<jint>(x_dip), | 687 static_cast<jint>(x_dip), |
| 688 static_cast<jint>(y_dip)); | 688 static_cast<jint>(y_dip)); |
| 689 } | 689 } |
| 690 | 690 |
| 691 void ContentViewCoreImpl::GetScaledContentBitmap( | 691 void ContentViewCoreImpl::GetScaledContentBitmap( |
| 692 float scale, | 692 float scale, |
| 693 gfx::Size* out_size, | 693 gfx::Size* out_size, |
| 694 jobject jbitmap_config, |
| 694 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { | 695 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { |
| 695 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 696 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| 696 if (!view) { | 697 if (!view) { |
| 697 result_callback.Run(false, SkBitmap()); | 698 result_callback.Run(false, SkBitmap()); |
| 698 return; | 699 return; |
| 699 } | 700 } |
| 700 | 701 SkBitmap::Config skbitmap_format = gfx::ConvertToSkiaConfig(jbitmap_config); |
| 701 view->GetScaledContentBitmap(scale, out_size, result_callback); | 702 view->GetScaledContentBitmap(scale, out_size, skbitmap_format, |
| 703 result_callback); |
| 702 } | 704 } |
| 703 | 705 |
| 704 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { | 706 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { |
| 705 JNIEnv* env = AttachCurrentThread(); | 707 JNIEnv* env = AttachCurrentThread(); |
| 706 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 708 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 707 if (j_obj.is_null()) | 709 if (j_obj.is_null()) |
| 708 return; | 710 return; |
| 709 ScopedJavaLocalRef<jstring> jcontent_url = | 711 ScopedJavaLocalRef<jstring> jcontent_url = |
| 710 ConvertUTF8ToJavaString(env, content_url.spec()); | 712 ConvertUTF8ToJavaString(env, content_url.spec()); |
| 711 Java_ContentViewCore_startContentIntent(env, | 713 Java_ContentViewCore_startContentIntent(env, |
| (...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1866 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1868 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1867 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1869 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1868 return reinterpret_cast<intptr_t>(view); | 1870 return reinterpret_cast<intptr_t>(view); |
| 1869 } | 1871 } |
| 1870 | 1872 |
| 1871 bool RegisterContentViewCore(JNIEnv* env) { | 1873 bool RegisterContentViewCore(JNIEnv* env) { |
| 1872 return RegisterNativesImpl(env); | 1874 return RegisterNativesImpl(env); |
| 1873 } | 1875 } |
| 1874 | 1876 |
| 1875 } // namespace content | 1877 } // namespace content |
| OLD | NEW |