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