| 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 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 break; | 1535 break; |
| 1536 } | 1536 } |
| 1537 case JNI_DragEvent::ACTION_DRAG_EXITED: | 1537 case JNI_DragEvent::ACTION_DRAG_EXITED: |
| 1538 wcva->OnDragExited(); | 1538 wcva->OnDragExited(); |
| 1539 break; | 1539 break; |
| 1540 default: // STARTED and ENDED. Nothing meaningful to do. | 1540 default: // STARTED and ENDED. Nothing meaningful to do. |
| 1541 break; | 1541 break; |
| 1542 } | 1542 } |
| 1543 } | 1543 } |
| 1544 | 1544 |
| 1545 void ContentViewCoreImpl::RequestTextSurroundingSelection( | |
| 1546 int max_length, | |
| 1547 const base::Callback< | |
| 1548 void(const base::string16& content, int start_offset, int end_offset)>& | |
| 1549 callback) { | |
| 1550 DCHECK(!callback.is_null()); | |
| 1551 RenderFrameHost* focused_frame = web_contents_->GetFocusedFrame(); | |
| 1552 if (!focused_frame) | |
| 1553 return; | |
| 1554 if (GetRenderWidgetHostViewAndroid()) { | |
| 1555 GetRenderWidgetHostViewAndroid()->SetTextSurroundingSelectionCallback( | |
| 1556 callback); | |
| 1557 focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest( | |
| 1558 focused_frame->GetRoutingID(), max_length)); | |
| 1559 } | |
| 1560 } | |
| 1561 | |
| 1562 void ContentViewCoreImpl::OnShowUnhandledTapUIIfNeeded(int x_dip, int y_dip) { | 1545 void ContentViewCoreImpl::OnShowUnhandledTapUIIfNeeded(int x_dip, int y_dip) { |
| 1563 JNIEnv* env = AttachCurrentThread(); | 1546 JNIEnv* env = AttachCurrentThread(); |
| 1564 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1547 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1565 if (obj.is_null()) | 1548 if (obj.is_null()) |
| 1566 return; | 1549 return; |
| 1567 Java_ContentViewCore_onShowUnhandledTapUIIfNeeded( | 1550 Java_ContentViewCore_onShowUnhandledTapUIIfNeeded( |
| 1568 env, obj.obj(), static_cast<jint>(x_dip * dpi_scale()), | 1551 env, obj.obj(), static_cast<jint>(x_dip * dpi_scale()), |
| 1569 static_cast<jint>(y_dip * dpi_scale())); | 1552 static_cast<jint>(y_dip * dpi_scale())); |
| 1570 } | 1553 } |
| 1571 | 1554 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 return ScopedJavaLocalRef<jobject>(); | 1633 return ScopedJavaLocalRef<jobject>(); |
| 1651 | 1634 |
| 1652 return view->GetJavaObject(); | 1635 return view->GetJavaObject(); |
| 1653 } | 1636 } |
| 1654 | 1637 |
| 1655 bool RegisterContentViewCore(JNIEnv* env) { | 1638 bool RegisterContentViewCore(JNIEnv* env) { |
| 1656 return RegisterNativesImpl(env) && JNI_DragEvent::RegisterNativesImpl(env); | 1639 return RegisterNativesImpl(env) && JNI_DragEvent::RegisterNativesImpl(env); |
| 1657 } | 1640 } |
| 1658 | 1641 |
| 1659 } // namespace content | 1642 } // namespace content |
| OLD | NEW |