| 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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 | 600 |
| 601 gfx::PointF selection_anchor_pix = | 601 gfx::PointF selection_anchor_pix = |
| 602 gfx::ScalePoint(selection_anchor, dpi_scale()); | 602 gfx::ScalePoint(selection_anchor, dpi_scale()); |
| 603 gfx::RectF selection_rect_pix = gfx::ScaleRect(selection_rect, dpi_scale()); | 603 gfx::RectF selection_rect_pix = gfx::ScaleRect(selection_rect, dpi_scale()); |
| 604 Java_ContentViewCore_onSelectionEvent( | 604 Java_ContentViewCore_onSelectionEvent( |
| 605 env, j_obj.obj(), event, selection_anchor_pix.x(), | 605 env, j_obj.obj(), event, selection_anchor_pix.x(), |
| 606 selection_anchor_pix.y(), selection_rect_pix.x(), selection_rect_pix.y(), | 606 selection_anchor_pix.y(), selection_rect_pix.x(), selection_rect_pix.y(), |
| 607 selection_rect_pix.right(), selection_rect_pix.bottom()); | 607 selection_rect_pix.right(), selection_rect_pix.bottom()); |
| 608 } | 608 } |
| 609 | 609 |
| 610 void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) { | 610 bool ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) { |
| 611 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 611 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| 612 if (!view) | 612 if (!view) |
| 613 return; | 613 return false; |
| 614 | 614 |
| 615 view->OnShowingPastePopup(gfx::PointF(x_dip, y_dip)); | 615 view->OnShowingPastePopup(gfx::PointF(x_dip, y_dip)); |
| 616 | 616 |
| 617 JNIEnv* env = AttachCurrentThread(); | 617 JNIEnv* env = AttachCurrentThread(); |
| 618 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 618 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 619 if (obj.is_null()) | 619 if (obj.is_null()) |
| 620 return; | 620 return false; |
| 621 Java_ContentViewCore_showPastePopupWithFeedback( | 621 return Java_ContentViewCore_showPastePopupWithFeedback( |
| 622 env, obj.obj(), static_cast<jint>(x_dip * dpi_scale()), | 622 env, obj.obj(), static_cast<jint>(x_dip * dpi_scale()), |
| 623 static_cast<jint>(y_dip * dpi_scale())); | 623 static_cast<jint>(y_dip * dpi_scale())); |
| 624 } | 624 } |
| 625 | 625 |
| 626 void ContentViewCoreImpl::GetScaledContentBitmap( | 626 void ContentViewCoreImpl::GetScaledContentBitmap( |
| 627 float scale, | 627 float scale, |
| 628 SkColorType preferred_color_type, | 628 SkColorType preferred_color_type, |
| 629 const gfx::Rect& src_subrect, | 629 const gfx::Rect& src_subrect, |
| 630 const ReadbackRequestCallback& result_callback) { | 630 const ReadbackRequestCallback& result_callback) { |
| 631 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 631 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 return ScopedJavaLocalRef<jobject>(); | 1454 return ScopedJavaLocalRef<jobject>(); |
| 1455 | 1455 |
| 1456 return view->GetJavaObject(); | 1456 return view->GetJavaObject(); |
| 1457 } | 1457 } |
| 1458 | 1458 |
| 1459 bool RegisterContentViewCore(JNIEnv* env) { | 1459 bool RegisterContentViewCore(JNIEnv* env) { |
| 1460 return RegisterNativesImpl(env); | 1460 return RegisterNativesImpl(env); |
| 1461 } | 1461 } |
| 1462 | 1462 |
| 1463 } // namespace content | 1463 } // namespace content |
| OLD | NEW |