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