| 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 break; | 612 break; |
| 613 case WebInputEvent::GestureScrollEnd: | 613 case WebInputEvent::GestureScrollEnd: |
| 614 Java_ContentViewCore_onScrollEndEventAck(env, j_obj.obj()); | 614 Java_ContentViewCore_onScrollEndEventAck(env, j_obj.obj()); |
| 615 break; | 615 break; |
| 616 case WebInputEvent::GesturePinchBegin: | 616 case WebInputEvent::GesturePinchBegin: |
| 617 Java_ContentViewCore_onPinchBeginEventAck(env, j_obj.obj()); | 617 Java_ContentViewCore_onPinchBeginEventAck(env, j_obj.obj()); |
| 618 break; | 618 break; |
| 619 case WebInputEvent::GesturePinchEnd: | 619 case WebInputEvent::GesturePinchEnd: |
| 620 Java_ContentViewCore_onPinchEndEventAck(env, j_obj.obj()); | 620 Java_ContentViewCore_onPinchEndEventAck(env, j_obj.obj()); |
| 621 break; | 621 break; |
| 622 case WebInputEvent::GestureDoubleTap: |
| 623 Java_ContentViewCore_onDoubleTapEventAck(env, j_obj.obj()); |
| 624 break; |
| 622 default: | 625 default: |
| 623 break; | 626 break; |
| 624 } | 627 } |
| 625 } | 628 } |
| 626 | 629 |
| 627 bool ContentViewCoreImpl::FilterInputEvent(const blink::WebInputEvent& event) { | 630 bool ContentViewCoreImpl::FilterInputEvent(const blink::WebInputEvent& event) { |
| 628 if (!WebInputEvent::isGestureEventType(event.type)) | 631 if (event.type != WebInputEvent::GestureTap && |
| 632 event.type != WebInputEvent::GestureDoubleTap && |
| 633 event.type != WebInputEvent::GestureLongTap && |
| 634 event.type != WebInputEvent::GestureLongPress) |
| 629 return false; | 635 return false; |
| 630 | 636 |
| 631 JNIEnv* env = AttachCurrentThread(); | 637 JNIEnv* env = AttachCurrentThread(); |
| 632 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 638 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 633 if (j_obj.is_null()) | 639 if (j_obj.is_null()) |
| 634 return false; | 640 return false; |
| 635 | 641 |
| 636 const blink::WebGestureEvent& gesture = | 642 const blink::WebGestureEvent& gesture = |
| 637 static_cast<const blink::WebGestureEvent&>(event); | 643 static_cast<const blink::WebGestureEvent&>(event); |
| 638 int gesture_type = ToContentViewGestureHandlerType(event.type); | 644 int gesture_type = ToContentViewGestureHandlerType(event.type); |
| 639 return Java_ContentViewCore_filterGestureEvent(env, | 645 return Java_ContentViewCore_filterTapOrPressEvent(env, |
| 640 j_obj.obj(), | 646 j_obj.obj(), |
| 641 gesture_type, | 647 gesture_type, |
| 642 gesture.x, | 648 gesture.x, |
| 643 gesture.y); | 649 gesture.y); |
| 644 } | 650 } |
| 645 | 651 |
| 646 bool ContentViewCoreImpl::HasFocus() { | 652 bool ContentViewCoreImpl::HasFocus() { |
| 647 JNIEnv* env = AttachCurrentThread(); | 653 JNIEnv* env = AttachCurrentThread(); |
| 648 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 654 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 649 if (obj.is_null()) | 655 if (obj.is_null()) |
| 650 return false; | 656 return false; |
| 651 return Java_ContentViewCore_hasFocus(env, obj.obj()); | 657 return Java_ContentViewCore_hasFocus(env, obj.obj()); |
| 652 } | 658 } |
| 653 | 659 |
| (...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1866 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1872 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1867 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1873 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1868 return reinterpret_cast<intptr_t>(view); | 1874 return reinterpret_cast<intptr_t>(view); |
| 1869 } | 1875 } |
| 1870 | 1876 |
| 1871 bool RegisterContentViewCore(JNIEnv* env) { | 1877 bool RegisterContentViewCore(JNIEnv* env) { |
| 1872 return RegisterNativesImpl(env); | 1878 return RegisterNativesImpl(env); |
| 1873 } | 1879 } |
| 1874 | 1880 |
| 1875 } // namespace content | 1881 } // namespace content |
| OLD | NEW |