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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 InputEventAckState ack_result) { | 546 InputEventAckState ack_result) { |
547 JNIEnv* env = AttachCurrentThread(); | 547 JNIEnv* env = AttachCurrentThread(); |
548 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 548 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
549 if (j_obj.is_null()) | 549 if (j_obj.is_null()) |
550 return; | 550 return; |
551 | 551 |
552 switch (event.type) { | 552 switch (event.type) { |
553 case WebInputEvent::GestureFlingStart: | 553 case WebInputEvent::GestureFlingStart: |
554 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) { | 554 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) { |
555 // The view expects the fling velocity in pixels/s. | 555 // The view expects the fling velocity in pixels/s. |
556 Java_ContentViewCore_onFlingStartEventConsumed( | 556 Java_ContentViewCore_onFlingStartEventConsumed(env, j_obj); |
557 env, j_obj, event.data.flingStart.velocityX * dpi_scale(), | |
558 event.data.flingStart.velocityY * dpi_scale()); | |
559 } else { | 557 } else { |
560 // If a scroll ends with a fling, a SCROLL_END event is never sent. | 558 // If a scroll ends with a fling, a SCROLL_END event is never sent. |
561 // However, if that fling went unconsumed, we still need to let the | 559 // However, if that fling went unconsumed, we still need to let the |
562 // listeners know that scrolling has ended. | 560 // listeners know that scrolling has ended. |
563 Java_ContentViewCore_onScrollEndEventAck(env, j_obj); | 561 Java_ContentViewCore_onScrollEndEventAck(env, j_obj); |
564 } | 562 } |
565 break; | 563 break; |
566 case WebInputEvent::GestureFlingCancel: | 564 case WebInputEvent::GestureFlingCancel: |
567 Java_ContentViewCore_onFlingCancelEventAck(env, j_obj); | 565 Java_ContentViewCore_onFlingCancelEventAck(env, j_obj); |
568 break; | 566 break; |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 return ScopedJavaLocalRef<jobject>(); | 1601 return ScopedJavaLocalRef<jobject>(); |
1604 | 1602 |
1605 return view->GetJavaObject(); | 1603 return view->GetJavaObject(); |
1606 } | 1604 } |
1607 | 1605 |
1608 bool RegisterContentViewCore(JNIEnv* env) { | 1606 bool RegisterContentViewCore(JNIEnv* env) { |
1609 return RegisterNativesImpl(env); | 1607 return RegisterNativesImpl(env); |
1610 } | 1608 } |
1611 | 1609 |
1612 } // namespace content | 1610 } // namespace content |
OLD | NEW |