| 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 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 break; | 1539 break; |
| 1540 case JNI_DragEvent::ACTION_DRAG_ENDED: | 1540 case JNI_DragEvent::ACTION_DRAG_ENDED: |
| 1541 wcva->OnDragEnded(); | 1541 wcva->OnDragEnded(); |
| 1542 break; | 1542 break; |
| 1543 case JNI_DragEvent::ACTION_DRAG_STARTED: | 1543 case JNI_DragEvent::ACTION_DRAG_STARTED: |
| 1544 // Nothing meaningful to do. | 1544 // Nothing meaningful to do. |
| 1545 break; | 1545 break; |
| 1546 } | 1546 } |
| 1547 } | 1547 } |
| 1548 | 1548 |
| 1549 void ContentViewCoreImpl::RequestTextSurroundingSelection( | |
| 1550 int max_length, | |
| 1551 const base::Callback< | |
| 1552 void(const base::string16& content, int start_offset, int end_offset)>& | |
| 1553 callback) { | |
| 1554 DCHECK(!callback.is_null()); | |
| 1555 RenderFrameHost* focused_frame = web_contents_->GetFocusedFrame(); | |
| 1556 if (!focused_frame) | |
| 1557 return; | |
| 1558 if (GetRenderWidgetHostViewAndroid()) { | |
| 1559 GetRenderWidgetHostViewAndroid()->SetTextSurroundingSelectionCallback( | |
| 1560 callback); | |
| 1561 focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest( | |
| 1562 focused_frame->GetRoutingID(), max_length)); | |
| 1563 } | |
| 1564 } | |
| 1565 | |
| 1566 void ContentViewCoreImpl::OnShowUnhandledTapUIIfNeeded(int x_dip, int y_dip) { | 1549 void ContentViewCoreImpl::OnShowUnhandledTapUIIfNeeded(int x_dip, int y_dip) { |
| 1567 JNIEnv* env = AttachCurrentThread(); | 1550 JNIEnv* env = AttachCurrentThread(); |
| 1568 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1551 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1569 if (obj.is_null()) | 1552 if (obj.is_null()) |
| 1570 return; | 1553 return; |
| 1571 Java_ContentViewCore_onShowUnhandledTapUIIfNeeded( | 1554 Java_ContentViewCore_onShowUnhandledTapUIIfNeeded( |
| 1572 env, obj.obj(), static_cast<jint>(x_dip * dpi_scale()), | 1555 env, obj.obj(), static_cast<jint>(x_dip * dpi_scale()), |
| 1573 static_cast<jint>(y_dip * dpi_scale())); | 1556 static_cast<jint>(y_dip * dpi_scale())); |
| 1574 } | 1557 } |
| 1575 | 1558 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1663 return ScopedJavaLocalRef<jobject>(); | 1646 return ScopedJavaLocalRef<jobject>(); |
| 1664 | 1647 |
| 1665 return view->GetJavaObject(); | 1648 return view->GetJavaObject(); |
| 1666 } | 1649 } |
| 1667 | 1650 |
| 1668 bool RegisterContentViewCore(JNIEnv* env) { | 1651 bool RegisterContentViewCore(JNIEnv* env) { |
| 1669 return RegisterNativesImpl(env) && JNI_DragEvent::RegisterNativesImpl(env); | 1652 return RegisterNativesImpl(env) && JNI_DragEvent::RegisterNativesImpl(env); |
| 1670 } | 1653 } |
| 1671 | 1654 |
| 1672 } // namespace content | 1655 } // namespace content |
| OLD | NEW |