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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 668 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
669 if (obj.is_null()) | 669 if (obj.is_null()) |
670 return; | 670 return; |
671 Java_ContentViewCore_showPastePopup(env, obj.obj(), | 671 Java_ContentViewCore_showPastePopup(env, obj.obj(), |
672 static_cast<jint>(x_dip), | 672 static_cast<jint>(x_dip), |
673 static_cast<jint>(y_dip)); | 673 static_cast<jint>(y_dip)); |
674 } | 674 } |
675 | 675 |
676 void ContentViewCoreImpl::GetScaledContentBitmap( | 676 void ContentViewCoreImpl::GetScaledContentBitmap( |
677 float scale, | 677 float scale, |
678 jobject jbitmap_config, | 678 SkBitmap::Config bitmap_config, |
679 gfx::Rect src_subrect, | 679 gfx::Rect src_subrect, |
680 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { | 680 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { |
681 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 681 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
682 if (!view) { | 682 if (!view) { |
683 result_callback.Run(false, SkBitmap()); | 683 result_callback.Run(false, SkBitmap()); |
684 return; | 684 return; |
685 } | 685 } |
686 SkBitmap::Config skbitmap_format = gfx::ConvertToSkiaConfig(jbitmap_config); | 686 view->GetScaledContentBitmap(scale, bitmap_config, src_subrect, |
687 view->GetScaledContentBitmap(scale, skbitmap_format, src_subrect, | |
688 result_callback); | 687 result_callback); |
689 } | 688 } |
690 | 689 |
691 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { | 690 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { |
692 JNIEnv* env = AttachCurrentThread(); | 691 JNIEnv* env = AttachCurrentThread(); |
693 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 692 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
694 if (j_obj.is_null()) | 693 if (j_obj.is_null()) |
695 return; | 694 return; |
696 ScopedJavaLocalRef<jstring> jcontent_url = | 695 ScopedJavaLocalRef<jstring> jcontent_url = |
697 ConvertUTF8ToJavaString(env, content_url.spec()); | 696 ConvertUTF8ToJavaString(env, content_url.spec()); |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1660 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1662 retained_objects_set); | 1661 retained_objects_set); |
1663 return reinterpret_cast<intptr_t>(view); | 1662 return reinterpret_cast<intptr_t>(view); |
1664 } | 1663 } |
1665 | 1664 |
1666 bool RegisterContentViewCore(JNIEnv* env) { | 1665 bool RegisterContentViewCore(JNIEnv* env) { |
1667 return RegisterNativesImpl(env); | 1666 return RegisterNativesImpl(env); |
1668 } | 1667 } |
1669 | 1668 |
1670 } // namespace content | 1669 } // namespace content |
OLD | NEW |