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