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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 | 593 |
594 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) { | 594 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) { |
595 JNIEnv* env = AttachCurrentThread(); | 595 JNIEnv* env = AttachCurrentThread(); |
596 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 596 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
597 if (obj.is_null()) | 597 if (obj.is_null()) |
598 return; | 598 return; |
599 ScopedJavaLocalRef<jstring> jtext = ConvertUTF8ToJavaString(env, text); | 599 ScopedJavaLocalRef<jstring> jtext = ConvertUTF8ToJavaString(env, text); |
600 Java_ContentViewCore_onSelectionChanged(env, obj.obj(), jtext.obj()); | 600 Java_ContentViewCore_onSelectionChanged(env, obj.obj(), jtext.obj()); |
601 } | 601 } |
602 | 602 |
603 void ContentViewCoreImpl::OnSelectionBoundsChanged( | 603 void ContentViewCoreImpl::OnSelectionBoundsChanged(const gfx::PointF& anchor, |
604 const ViewHostMsg_SelectionBounds_Params& params) { | 604 const gfx::PointF& focus, |
| 605 int anchor_dir, |
| 606 int focus_dir, |
| 607 bool is_anchor_first, |
| 608 bool is_anchor_visible, |
| 609 bool is_focus_visible) { |
605 JNIEnv* env = AttachCurrentThread(); | 610 JNIEnv* env = AttachCurrentThread(); |
606 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 611 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
607 if (obj.is_null()) | 612 if (obj.is_null()) |
608 return; | 613 return; |
609 ScopedJavaLocalRef<jobject> anchor_rect_dip( | 614 Java_ContentViewCore_onSelectionBoundsChanged(env, |
610 CreateJavaRect(env, params.anchor_rect)); | 615 obj.obj(), |
611 ScopedJavaLocalRef<jobject> focus_rect_dip( | 616 anchor.x(), |
612 CreateJavaRect(env, params.focus_rect)); | 617 anchor.y(), |
613 Java_ContentViewCore_onSelectionBoundsChanged(env, obj.obj(), | 618 focus.x(), |
614 anchor_rect_dip.obj(), | 619 focus.y(), |
615 params.anchor_dir, | 620 anchor_dir, |
616 focus_rect_dip.obj(), | 621 focus_dir, |
617 params.focus_dir, | 622 is_anchor_first, |
618 params.is_anchor_first); | 623 is_anchor_visible, |
| 624 is_focus_visible); |
619 } | 625 } |
620 | 626 |
621 void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) { | 627 void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) { |
622 JNIEnv* env = AttachCurrentThread(); | 628 JNIEnv* env = AttachCurrentThread(); |
623 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 629 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
624 if (obj.is_null()) | 630 if (obj.is_null()) |
625 return; | 631 return; |
626 Java_ContentViewCore_showPastePopup(env, obj.obj(), | 632 Java_ContentViewCore_showPastePopup(env, obj.obj(), |
627 static_cast<jint>(x_dip), | 633 static_cast<jint>(x_dip), |
628 static_cast<jint>(y_dip)); | 634 static_cast<jint>(y_dip)); |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1632 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1627 retained_objects_set); | 1633 retained_objects_set); |
1628 return reinterpret_cast<intptr_t>(view); | 1634 return reinterpret_cast<intptr_t>(view); |
1629 } | 1635 } |
1630 | 1636 |
1631 bool RegisterContentViewCore(JNIEnv* env) { | 1637 bool RegisterContentViewCore(JNIEnv* env) { |
1632 return RegisterNativesImpl(env); | 1638 return RegisterNativesImpl(env); |
1633 } | 1639 } |
1634 | 1640 |
1635 } // namespace content | 1641 } // namespace content |
OLD | NEW |