| 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 | 583 |
| 584 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) { | 584 void ContentViewCoreImpl::OnSelectionChanged(const std::string& text) { |
| 585 JNIEnv* env = AttachCurrentThread(); | 585 JNIEnv* env = AttachCurrentThread(); |
| 586 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 586 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 587 if (obj.is_null()) | 587 if (obj.is_null()) |
| 588 return; | 588 return; |
| 589 ScopedJavaLocalRef<jstring> jtext = ConvertUTF8ToJavaString(env, text); | 589 ScopedJavaLocalRef<jstring> jtext = ConvertUTF8ToJavaString(env, text); |
| 590 Java_ContentViewCore_onSelectionChanged(env, obj.obj(), jtext.obj()); | 590 Java_ContentViewCore_onSelectionChanged(env, obj.obj(), jtext.obj()); |
| 591 } | 591 } |
| 592 | 592 |
| 593 void ContentViewCoreImpl::OnSelectionEvent(SelectionEventType event, | 593 void ContentViewCoreImpl::OnSelectionEvent(ui::SelectionEventType event, |
| 594 const gfx::PointF& position) { | 594 const gfx::PointF& position) { |
| 595 JNIEnv* env = AttachCurrentThread(); | 595 JNIEnv* env = AttachCurrentThread(); |
| 596 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 596 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 597 if (j_obj.is_null()) | 597 if (j_obj.is_null()) |
| 598 return; | 598 return; |
| 599 Java_ContentViewCore_onSelectionEvent( | 599 Java_ContentViewCore_onSelectionEvent( |
| 600 env, j_obj.obj(), event, position.x(), position.y()); | 600 env, j_obj.obj(), event, position.x(), position.y()); |
| 601 } | 601 } |
| 602 | 602 |
| 603 scoped_ptr<TouchHandleDrawable> | 603 scoped_ptr<ui::TouchHandleDrawable> |
| 604 ContentViewCoreImpl::CreatePopupTouchHandleDrawable() { | 604 ContentViewCoreImpl::CreatePopupTouchHandleDrawable() { |
| 605 JNIEnv* env = AttachCurrentThread(); | 605 JNIEnv* env = AttachCurrentThread(); |
| 606 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 606 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 607 if (obj.is_null()) { | 607 if (obj.is_null()) { |
| 608 NOTREACHED(); | 608 NOTREACHED(); |
| 609 return scoped_ptr<TouchHandleDrawable>(); | 609 return scoped_ptr<ui::TouchHandleDrawable>(); |
| 610 } | 610 } |
| 611 return scoped_ptr<TouchHandleDrawable>(new PopupTouchHandleDrawable( | 611 return scoped_ptr<ui::TouchHandleDrawable>(new PopupTouchHandleDrawable( |
| 612 Java_ContentViewCore_createPopupTouchHandleDrawable(env, obj.obj()), | 612 Java_ContentViewCore_createPopupTouchHandleDrawable(env, obj.obj()), |
| 613 dpi_scale_)); | 613 dpi_scale_)); |
| 614 } | 614 } |
| 615 | 615 |
| 616 void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) { | 616 void ContentViewCoreImpl::ShowPastePopup(int x_dip, int y_dip) { |
| 617 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); | 617 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
| 618 if (!view) | 618 if (!view) |
| 619 return; | 619 return; |
| 620 | 620 |
| 621 view->OnShowingPastePopup(gfx::PointF(x_dip, y_dip)); | 621 view->OnShowingPastePopup(gfx::PointF(x_dip, y_dip)); |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1339 reinterpret_cast<ui::WindowAndroid*>(window_android), |
| 1340 retained_objects_set); | 1340 retained_objects_set); |
| 1341 return reinterpret_cast<intptr_t>(view); | 1341 return reinterpret_cast<intptr_t>(view); |
| 1342 } | 1342 } |
| 1343 | 1343 |
| 1344 bool RegisterContentViewCore(JNIEnv* env) { | 1344 bool RegisterContentViewCore(JNIEnv* env) { |
| 1345 return RegisterNativesImpl(env); | 1345 return RegisterNativesImpl(env); |
| 1346 } | 1346 } |
| 1347 | 1347 |
| 1348 } // namespace content | 1348 } // namespace content |
| OLD | NEW |