| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 return Java_ContentViewCore_hasFocus(env, obj); | 589 return Java_ContentViewCore_hasFocus(env, obj); |
| 590 } | 590 } |
| 591 | 591 |
| 592 void ContentViewCoreImpl::RequestDisallowInterceptTouchEvent() { | 592 void ContentViewCoreImpl::RequestDisallowInterceptTouchEvent() { |
| 593 JNIEnv* env = AttachCurrentThread(); | 593 JNIEnv* env = AttachCurrentThread(); |
| 594 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 594 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 595 if (!obj.is_null()) | 595 if (!obj.is_null()) |
| 596 Java_ContentViewCore_requestDisallowInterceptTouchEvent(env, obj); | 596 Java_ContentViewCore_requestDisallowInterceptTouchEvent(env, obj); |
| 597 } | 597 } |
| 598 | 598 |
| 599 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) { | |
| 600 JNIEnv* env = AttachCurrentThread(); | |
| 601 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 602 if (obj.is_null()) | |
| 603 return; | |
| 604 ScopedJavaLocalRef<jstring> jtext = ConvertUTF8ToJavaString(env, text); | |
| 605 Java_ContentViewCore_onSelectionChanged(env, obj, jtext); | |
| 606 } | |
| 607 | |
| 608 void ContentViewCoreImpl::OnSelectionEvent(ui::SelectionEventType event, | |
| 609 const gfx::PointF& selection_anchor, | |
| 610 const gfx::RectF& selection_rect) { | |
| 611 JNIEnv* env = AttachCurrentThread(); | |
| 612 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | |
| 613 if (j_obj.is_null()) | |
| 614 return; | |
| 615 | |
| 616 Java_ContentViewCore_onSelectionEvent( | |
| 617 env, j_obj, event, selection_anchor.x(), selection_anchor.y(), | |
| 618 selection_rect.x(), selection_rect.y(), selection_rect.right(), | |
| 619 selection_rect.bottom()); | |
| 620 } | |
| 621 | |
| 622 bool ContentViewCoreImpl::ShowPastePopup(const ContextMenuParams& params) { | 599 bool ContentViewCoreImpl::ShowPastePopup(const ContextMenuParams& params) { |
| 623 // Display paste pop-up only when selection is empty and editable. | 600 // Display paste pop-up only when selection is empty and editable. |
| 624 if (!(params.is_editable && params.selection_text.empty())) | 601 if (!(params.is_editable && params.selection_text.empty())) |
| 625 return false; | 602 return false; |
| 626 | 603 |
| 627 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 604 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| 628 if (!view) | 605 if (!view) |
| 629 return false; | 606 return false; |
| 630 | 607 |
| 631 JNIEnv* env = AttachCurrentThread(); | 608 JNIEnv* env = AttachCurrentThread(); |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 return ScopedJavaLocalRef<jobject>(); | 1290 return ScopedJavaLocalRef<jobject>(); |
| 1314 | 1291 |
| 1315 return view->GetJavaObject(); | 1292 return view->GetJavaObject(); |
| 1316 } | 1293 } |
| 1317 | 1294 |
| 1318 bool RegisterContentViewCore(JNIEnv* env) { | 1295 bool RegisterContentViewCore(JNIEnv* env) { |
| 1319 return RegisterNativesImpl(env); | 1296 return RegisterNativesImpl(env); |
| 1320 } | 1297 } |
| 1321 | 1298 |
| 1322 } // namespace content | 1299 } // namespace content |
| OLD | NEW |