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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
691 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 691 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
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 jobject jbitmap_config, | |
jdduke (slow)
2014/02/26 20:33:09
Any reason we couldn't have simply used an SkBitma
powei
2014/02/26 20:38:19
This was my question in ps#3. I think the argumen
| |
701 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { | 702 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { |
702 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 703 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
703 if (!view) { | 704 if (!view) { |
704 result_callback.Run(false, SkBitmap()); | 705 result_callback.Run(false, SkBitmap()); |
705 return; | 706 return; |
706 } | 707 } |
707 | 708 SkBitmap::Config skbitmap_format = gfx::ConvertToSkiaConfig(jbitmap_config); |
708 view->GetScaledContentBitmap(scale, result_callback); | 709 view->GetScaledContentBitmap(scale, skbitmap_format, result_callback); |
709 } | 710 } |
710 | 711 |
711 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { | 712 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { |
712 JNIEnv* env = AttachCurrentThread(); | 713 JNIEnv* env = AttachCurrentThread(); |
713 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 714 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
714 if (j_obj.is_null()) | 715 if (j_obj.is_null()) |
715 return; | 716 return; |
716 ScopedJavaLocalRef<jstring> jcontent_url = | 717 ScopedJavaLocalRef<jstring> jcontent_url = |
717 ConvertUTF8ToJavaString(env, content_url.spec()); | 718 ConvertUTF8ToJavaString(env, content_url.spec()); |
718 Java_ContentViewCore_startContentIntent(env, | 719 Java_ContentViewCore_startContentIntent(env, |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1832 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1833 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1833 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1834 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1834 return reinterpret_cast<intptr_t>(view); | 1835 return reinterpret_cast<intptr_t>(view); |
1835 } | 1836 } |
1836 | 1837 |
1837 bool RegisterContentViewCore(JNIEnv* env) { | 1838 bool RegisterContentViewCore(JNIEnv* env) { |
1838 return RegisterNativesImpl(env); | 1839 return RegisterNativesImpl(env); |
1839 } | 1840 } |
1840 | 1841 |
1841 } // namespace content | 1842 } // namespace content |
OLD | NEW |