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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 623 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
624 if (obj.is_null()) | 624 if (obj.is_null()) |
625 return; | 625 return; |
626 Java_ContentViewCore_showPastePopup(env, obj.obj(), | 626 Java_ContentViewCore_showPastePopup(env, obj.obj(), |
627 static_cast<jint>(x_dip), | 627 static_cast<jint>(x_dip), |
628 static_cast<jint>(y_dip)); | 628 static_cast<jint>(y_dip)); |
629 } | 629 } |
630 | 630 |
631 void ContentViewCoreImpl::GetScaledContentBitmap( | 631 void ContentViewCoreImpl::GetScaledContentBitmap( |
632 float scale, | 632 float scale, |
633 jobject jbitmap_config, | 633 SkBitmap::Config bitmap_config, |
634 gfx::Rect src_subrect, | 634 gfx::Rect src_subrect, |
635 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { | 635 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { |
636 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 636 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
637 if (!view) { | 637 if (!view) { |
638 result_callback.Run(false, SkBitmap()); | 638 result_callback.Run(false, SkBitmap()); |
639 return; | 639 return; |
640 } | 640 } |
641 SkBitmap::Config skbitmap_format = gfx::ConvertToSkiaConfig(jbitmap_config); | 641 view->GetScaledContentBitmap(scale, bitmap_config, src_subrect, |
642 view->GetScaledContentBitmap(scale, skbitmap_format, src_subrect, | |
643 result_callback); | 642 result_callback); |
644 } | 643 } |
645 | 644 |
646 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { | 645 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { |
647 JNIEnv* env = AttachCurrentThread(); | 646 JNIEnv* env = AttachCurrentThread(); |
648 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 647 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
649 if (j_obj.is_null()) | 648 if (j_obj.is_null()) |
650 return; | 649 return; |
651 ScopedJavaLocalRef<jstring> jcontent_url = | 650 ScopedJavaLocalRef<jstring> jcontent_url = |
652 ConvertUTF8ToJavaString(env, content_url.spec()); | 651 ConvertUTF8ToJavaString(env, content_url.spec()); |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1689 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1691 retained_objects_set); | 1690 retained_objects_set); |
1692 return reinterpret_cast<intptr_t>(view); | 1691 return reinterpret_cast<intptr_t>(view); |
1693 } | 1692 } |
1694 | 1693 |
1695 bool RegisterContentViewCore(JNIEnv* env) { | 1694 bool RegisterContentViewCore(JNIEnv* env) { |
1696 return RegisterNativesImpl(env); | 1695 return RegisterNativesImpl(env); |
1697 } | 1696 } |
1698 | 1697 |
1699 } // namespace content | 1698 } // namespace content |
OLD | NEW |