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 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 drop_data.html = base::NullableString16(text_to_drop, false); | 1534 drop_data.html = base::NullableString16(text_to_drop, false); |
1535 } | 1535 } |
1536 } | 1536 } |
1537 | 1537 |
1538 wcva->OnPerformDrop(&drop_data, location, screen_location); | 1538 wcva->OnPerformDrop(&drop_data, location, screen_location); |
1539 break; | 1539 break; |
1540 } | 1540 } |
1541 case JNI_DragEvent::ACTION_DRAG_EXITED: | 1541 case JNI_DragEvent::ACTION_DRAG_EXITED: |
1542 wcva->OnDragExited(); | 1542 wcva->OnDragExited(); |
1543 break; | 1543 break; |
1544 default: // STARTED and ENDED. Nothing meaningful to do. | 1544 case JNI_DragEvent::ACTION_DRAG_ENDED: |
| 1545 wcva->OnDragEnded(); |
| 1546 break; |
| 1547 case JNI_DragEvent::ACTION_DRAG_STARTED: |
| 1548 // Nothing meaningful to do. |
1545 break; | 1549 break; |
1546 } | 1550 } |
1547 } | 1551 } |
1548 | 1552 |
1549 void ContentViewCoreImpl::RequestTextSurroundingSelection( | 1553 void ContentViewCoreImpl::RequestTextSurroundingSelection( |
1550 int max_length, | 1554 int max_length, |
1551 const base::Callback< | 1555 const base::Callback< |
1552 void(const base::string16& content, int start_offset, int end_offset)>& | 1556 void(const base::string16& content, int start_offset, int end_offset)>& |
1553 callback) { | 1557 callback) { |
1554 DCHECK(!callback.is_null()); | 1558 DCHECK(!callback.is_null()); |
(...skipping 11 matching lines...) Expand all Loading... |
1566 void ContentViewCoreImpl::OnShowUnhandledTapUIIfNeeded(int x_dip, int y_dip) { | 1570 void ContentViewCoreImpl::OnShowUnhandledTapUIIfNeeded(int x_dip, int y_dip) { |
1567 JNIEnv* env = AttachCurrentThread(); | 1571 JNIEnv* env = AttachCurrentThread(); |
1568 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1572 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
1569 if (obj.is_null()) | 1573 if (obj.is_null()) |
1570 return; | 1574 return; |
1571 Java_ContentViewCore_onShowUnhandledTapUIIfNeeded( | 1575 Java_ContentViewCore_onShowUnhandledTapUIIfNeeded( |
1572 env, obj.obj(), static_cast<jint>(x_dip * dpi_scale()), | 1576 env, obj.obj(), static_cast<jint>(x_dip * dpi_scale()), |
1573 static_cast<jint>(y_dip * dpi_scale())); | 1577 static_cast<jint>(y_dip * dpi_scale())); |
1574 } | 1578 } |
1575 | 1579 |
| 1580 void ContentViewCoreImpl::HidePopupsAndPreserveSelection() { |
| 1581 JNIEnv* env = AttachCurrentThread(); |
| 1582 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1583 if (obj.is_null()) |
| 1584 return; |
| 1585 |
| 1586 Java_ContentViewCore_hidePopupsAndPreserveSelection(env, obj.obj()); |
| 1587 } |
| 1588 |
1576 void ContentViewCoreImpl::OnSmartClipDataExtracted( | 1589 void ContentViewCoreImpl::OnSmartClipDataExtracted( |
1577 const base::string16& text, | 1590 const base::string16& text, |
1578 const base::string16& html, | 1591 const base::string16& html, |
1579 const gfx::Rect& clip_rect) { | 1592 const gfx::Rect& clip_rect) { |
1580 JNIEnv* env = AttachCurrentThread(); | 1593 JNIEnv* env = AttachCurrentThread(); |
1581 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1594 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
1582 if (obj.is_null()) | 1595 if (obj.is_null()) |
1583 return; | 1596 return; |
1584 ScopedJavaLocalRef<jstring> jtext = ConvertUTF16ToJavaString(env, text); | 1597 ScopedJavaLocalRef<jstring> jtext = ConvertUTF16ToJavaString(env, text); |
1585 ScopedJavaLocalRef<jstring> jhtml = ConvertUTF16ToJavaString(env, html); | 1598 ScopedJavaLocalRef<jstring> jhtml = ConvertUTF16ToJavaString(env, html); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 return ScopedJavaLocalRef<jobject>(); | 1667 return ScopedJavaLocalRef<jobject>(); |
1655 | 1668 |
1656 return view->GetJavaObject(); | 1669 return view->GetJavaObject(); |
1657 } | 1670 } |
1658 | 1671 |
1659 bool RegisterContentViewCore(JNIEnv* env) { | 1672 bool RegisterContentViewCore(JNIEnv* env) { |
1660 return RegisterNativesImpl(env) && JNI_DragEvent::RegisterNativesImpl(env); | 1673 return RegisterNativesImpl(env) && JNI_DragEvent::RegisterNativesImpl(env); |
1661 } | 1674 } |
1662 | 1675 |
1663 } // namespace content | 1676 } // namespace content |
OLD | NEW |