| 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 gfx::Size* out_size, | 701 gfx::Size* out_size, |
| 702 jobject jbitmap_config, |
| 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 | 709 SkBitmap::Config skbitmap_format = gfx::ConvertToSkiaConfig(jbitmap_config); |
| 709 view->GetScaledContentBitmap(scale, out_size, result_callback); | 710 view->GetScaledContentBitmap( |
| 711 scale, out_size, skbitmap_format, 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 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1841 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1843 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1842 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1844 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1843 return reinterpret_cast<intptr_t>(view); | 1845 return reinterpret_cast<intptr_t>(view); |
| 1844 } | 1846 } |
| 1845 | 1847 |
| 1846 bool RegisterContentViewCore(JNIEnv* env) { | 1848 bool RegisterContentViewCore(JNIEnv* env) { |
| 1847 return RegisterNativesImpl(env); | 1849 return RegisterNativesImpl(env); |
| 1848 } | 1850 } |
| 1849 | 1851 |
| 1850 } // namespace content | 1852 } // namespace content |
| OLD | NEW |