| 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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) { | 694 void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) { |
| 695 JNIEnv* env = AttachCurrentThread(); | 695 JNIEnv* env = AttachCurrentThread(); |
| 696 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 696 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 697 if (obj.is_null()) | 697 if (obj.is_null()) |
| 698 return; | 698 return; |
| 699 Java_ContentViewCore_showPastePopup(env, obj.obj(), | 699 Java_ContentViewCore_showPastePopup(env, obj.obj(), |
| 700 static_cast<jint>(x_dip), | 700 static_cast<jint>(x_dip), |
| 701 static_cast<jint>(y_dip)); | 701 static_cast<jint>(y_dip)); |
| 702 } | 702 } |
| 703 | 703 |
| 704 void ContentViewCoreImpl::GetScaledContentBitmap( | 704 unsigned int ContentViewCoreImpl::GetScaledContentTexture( |
| 705 float scale, | 705 float scale, |
| 706 gfx::Size* out_size, | 706 gfx::Size* out_size) { |
| 707 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { | |
| 708 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 707 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| 709 if (!view) { | 708 if (!view) |
| 710 result_callback.Run(false, SkBitmap()); | 709 return 0; |
| 711 return; | |
| 712 } | |
| 713 | 710 |
| 714 view->GetScaledContentBitmap(scale, out_size, result_callback); | 711 return view->GetScaledContentTexture(scale, out_size); |
| 715 } | 712 } |
| 716 | 713 |
| 717 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { | 714 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { |
| 718 JNIEnv* env = AttachCurrentThread(); | 715 JNIEnv* env = AttachCurrentThread(); |
| 719 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 716 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 720 if (j_obj.is_null()) | 717 if (j_obj.is_null()) |
| 721 return; | 718 return; |
| 722 ScopedJavaLocalRef<jstring> jcontent_url = | 719 ScopedJavaLocalRef<jstring> jcontent_url = |
| 723 ConvertUTF8ToJavaString(env, content_url.spec()); | 720 ConvertUTF8ToJavaString(env, content_url.spec()); |
| 724 Java_ContentViewCore_startContentIntent(env, | 721 Java_ContentViewCore_startContentIntent(env, |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1872 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1869 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1873 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1870 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1874 return reinterpret_cast<intptr_t>(view); | 1871 return reinterpret_cast<intptr_t>(view); |
| 1875 } | 1872 } |
| 1876 | 1873 |
| 1877 bool RegisterContentViewCore(JNIEnv* env) { | 1874 bool RegisterContentViewCore(JNIEnv* env) { |
| 1878 return RegisterNativesImpl(env); | 1875 return RegisterNativesImpl(env); |
| 1879 } | 1876 } |
| 1880 | 1877 |
| 1881 } // namespace content | 1878 } // namespace content |
| OLD | NEW |