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 unsigned int ContentViewCoreImpl::GetScaledContentTexture( | 704 void ContentViewCoreImpl::GetScaledContentBitmap( |
705 float scale, | 705 float scale, |
706 gfx::Size* out_size) { | 706 gfx::Size* out_size, |
707 const ContentBitmapCallback& result_callback) { | |
707 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 708 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
708 if (!view) | 709 if (!view || !view->IsSurfaceAvailableForCopy()) { |
David Trainor- moved to gerrit
2014/02/02 18:38:53
Should the view->IsSurfaceAvailableForCopy() check
powei
2014/02/03 10:06:52
Done.
| |
709 return 0; | 710 result_callback.Run(false, SkBitmap()); |
711 return; | |
712 } | |
710 | 713 |
711 return view->GetScaledContentTexture(scale, out_size); | 714 view->GetScaledContentBitmap(scale, out_size, result_callback); |
712 } | 715 } |
713 | 716 |
714 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { | 717 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { |
715 JNIEnv* env = AttachCurrentThread(); | 718 JNIEnv* env = AttachCurrentThread(); |
716 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 719 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
717 if (j_obj.is_null()) | 720 if (j_obj.is_null()) |
718 return; | 721 return; |
719 ScopedJavaLocalRef<jstring> jcontent_url = | 722 ScopedJavaLocalRef<jstring> jcontent_url = |
720 ConvertUTF8ToJavaString(env, content_url.spec()); | 723 ConvertUTF8ToJavaString(env, content_url.spec()); |
721 Java_ContentViewCore_startContentIntent(env, | 724 Java_ContentViewCore_startContentIntent(env, |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1868 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1871 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1869 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1872 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1870 return reinterpret_cast<intptr_t>(view); | 1873 return reinterpret_cast<intptr_t>(view); |
1871 } | 1874 } |
1872 | 1875 |
1873 bool RegisterContentViewCore(JNIEnv* env) { | 1876 bool RegisterContentViewCore(JNIEnv* env) { |
1874 return RegisterNativesImpl(env); | 1877 return RegisterNativesImpl(env); |
1875 } | 1878 } |
1876 | 1879 |
1877 } // namespace content | 1880 } // namespace content |
OLD | NEW |