Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 135403009: Rename GestureEventQueue to TouchDispositionGestureFilter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 web_contents_(static_cast<WebContentsImpl*>(web_contents)), 252 web_contents_(static_cast<WebContentsImpl*>(web_contents)),
253 root_layer_(cc::Layer::Create()), 253 root_layer_(cc::Layer::Create()),
254 vsync_interval_(base::TimeDelta::FromMicroseconds( 254 vsync_interval_(base::TimeDelta::FromMicroseconds(
255 kDefaultVSyncIntervalMicros)), 255 kDefaultVSyncIntervalMicros)),
256 expected_browser_composite_time_(base::TimeDelta::FromMicroseconds( 256 expected_browser_composite_time_(base::TimeDelta::FromMicroseconds(
257 kDefaultVSyncIntervalMicros * kDefaultBrowserCompositeVSyncFraction)), 257 kDefaultVSyncIntervalMicros * kDefaultBrowserCompositeVSyncFraction)),
258 view_android_(view_android), 258 view_android_(view_android),
259 window_android_(window_android), 259 window_android_(window_android),
260 device_orientation_(0), 260 device_orientation_(0),
261 geolocation_needs_pause_(false), 261 geolocation_needs_pause_(false),
262 gesture_event_queue_(this), 262 touch_disposition_gesture_filter_(this),
263 handling_touch_event_(false) { 263 handling_touch_event_(false) {
264 CHECK(web_contents) << 264 CHECK(web_contents) <<
265 "A ContentViewCoreImpl should be created with a valid WebContents."; 265 "A ContentViewCoreImpl should be created with a valid WebContents.";
266 266
267 const gfx::Display& display = 267 const gfx::Display& display =
268 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); 268 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
269 dpi_scale_ = display.device_scale_factor(); 269 dpi_scale_ = display.device_scale_factor();
270 270
271 // Currently, the only use case we have for overriding a user agent involves 271 // Currently, the only use case we have for overriding a user agent involves
272 // spoofing a desktop Linux user agent for "Request desktop site". 272 // spoofing a desktop Linux user agent for "Request desktop site".
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 env->SetIntArrayRegion(enabled_array.obj(), i, 1, &enabled); 579 env->SetIntArrayRegion(enabled_array.obj(), i, 1, &enabled);
580 } 580 }
581 ScopedJavaLocalRef<jobjectArray> items_array( 581 ScopedJavaLocalRef<jobjectArray> items_array(
582 base::android::ToJavaArrayOfStrings(env, labels)); 582 base::android::ToJavaArrayOfStrings(env, labels));
583 Java_ContentViewCore_showSelectPopup(env, j_obj.obj(), 583 Java_ContentViewCore_showSelectPopup(env, j_obj.obj(),
584 items_array.obj(), enabled_array.obj(), 584 items_array.obj(), enabled_array.obj(),
585 multiple, selected_array.obj()); 585 multiple, selected_array.obj());
586 } 586 }
587 587
588 void ContentViewCoreImpl::ConfirmTouchEvent(InputEventAckState ack_result) { 588 void ContentViewCoreImpl::ConfirmTouchEvent(InputEventAckState ack_result) {
589 gesture_event_queue_.OnTouchEventAck(ack_result); 589 touch_disposition_gesture_filter_.OnTouchEventAck(ack_result);
590 } 590 }
591 591
592 void ContentViewCoreImpl::OnGestureEventAck(const blink::WebGestureEvent& event, 592 void ContentViewCoreImpl::OnGestureEventAck(const blink::WebGestureEvent& event,
593 InputEventAckState ack_result) { 593 InputEventAckState ack_result) {
594 JNIEnv* env = AttachCurrentThread(); 594 JNIEnv* env = AttachCurrentThread();
595 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 595 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
596 if (j_obj.is_null()) 596 if (j_obj.is_null())
597 return; 597 return;
598 598
599 switch (event.type) { 599 switch (event.type) {
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 1044
1045 void ContentViewCoreImpl::OnTouchEventHandlingEnd(JNIEnv* env, jobject obj) { 1045 void ContentViewCoreImpl::OnTouchEventHandlingEnd(JNIEnv* env, jobject obj) {
1046 DCHECK(handling_touch_event_); 1046 DCHECK(handling_touch_event_);
1047 handling_touch_event_ = false; 1047 handling_touch_event_ = false;
1048 1048
1049 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); 1049 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
1050 if (!rwhv) 1050 if (!rwhv)
1051 return; 1051 return;
1052 1052
1053 // Note: Order is important here, as the touch may be ack'ed synchronously 1053 // Note: Order is important here, as the touch may be ack'ed synchronously
1054 gesture_event_queue_.OnGestureEventPacket(pending_gesture_packet_); 1054 touch_disposition_gesture_filter_.OnGestureEventPacket(
1055 pending_gesture_packet_);
1055 rwhv->SendTouchEvent(pending_touch_event_); 1056 rwhv->SendTouchEvent(pending_touch_event_);
1056 } 1057 }
1057 1058
1058 float ContentViewCoreImpl::GetTouchPaddingDip() { 1059 float ContentViewCoreImpl::GetTouchPaddingDip() {
1059 return 48.0f / GetDpiScale(); 1060 return 48.0f / GetDpiScale();
1060 } 1061 }
1061 1062
1062 float ContentViewCoreImpl::GetDpiScale() const { 1063 float ContentViewCoreImpl::GetDpiScale() const {
1063 return dpi_scale_; 1064 return dpi_scale_;
1064 } 1065 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 WebGestureEvent ContentViewCoreImpl::MakeGestureEvent( 1118 WebGestureEvent ContentViewCoreImpl::MakeGestureEvent(
1118 WebInputEvent::Type type, int64 time_ms, float x, float y) const { 1119 WebInputEvent::Type type, int64 time_ms, float x, float y) const {
1119 return WebGestureEventBuilder::Build( 1120 return WebGestureEventBuilder::Build(
1120 type, time_ms / 1000.0, x / GetDpiScale(), y / GetDpiScale()); 1121 type, time_ms / 1000.0, x / GetDpiScale(), y / GetDpiScale());
1121 } 1122 }
1122 1123
1123 void ContentViewCoreImpl::SendGestureEvent( 1124 void ContentViewCoreImpl::SendGestureEvent(
1124 const blink::WebGestureEvent& event) { 1125 const blink::WebGestureEvent& event) {
1125 // Gestures received while |handling_touch_event_| will accumulate until 1126 // Gestures received while |handling_touch_event_| will accumulate until
1126 // touch handling finishes, at which point the gestures will be pushed to the 1127 // touch handling finishes, at which point the gestures will be pushed to the
1127 // |gesture_event_queue_|. 1128 // |touch_disposition_gesture_filter_|.
1128 if (handling_touch_event_) { 1129 if (handling_touch_event_) {
1129 pending_gesture_packet_.Push(event); 1130 pending_gesture_packet_.Push(event);
1130 return; 1131 return;
1131 } 1132 }
1132 1133
1133 // TODO(jdduke): In general, timeout-based gestures *should* have the same 1134 // TODO(jdduke): In general, timeout-based gestures *should* have the same
1134 // timestamp as the initial TouchStart of the current sequence. We should 1135 // timestamp as the initial TouchStart of the current sequence. We should
1135 // verify that this is true, and use that as another timeout check. 1136 // verify that this is true, and use that as another timeout check.
1136 if (PossiblyTriggeredByTouchTimeout(event)) { 1137 if (PossiblyTriggeredByTouchTimeout(event)) {
1137 gesture_event_queue_.OnGestureEventPacket( 1138 touch_disposition_gesture_filter_.OnGestureEventPacket(
1138 GestureEventPacket::FromTouchTimeout(event)); 1139 GestureEventPacket::FromTouchTimeout(event));
1139 return; 1140 return;
1140 } 1141 }
1141 1142
1142 // If |event| was not (directly or indirectly) touch-derived, treat it as 1143 // If |event| was not (directly or indirectly) touch-derived, treat it as
1143 // a synthetic gesture event. 1144 // a synthetic gesture event.
1144 SendSyntheticGestureEvent(event); 1145 SendSyntheticGestureEvent(event);
1145 } 1146 }
1146 1147
1147 void ContentViewCoreImpl::SendSyntheticGestureEvent( 1148 void ContentViewCoreImpl::SendSyntheticGestureEvent(
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
1868 reinterpret_cast<ui::ViewAndroid*>(view_android), 1869 reinterpret_cast<ui::ViewAndroid*>(view_android),
1869 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1870 reinterpret_cast<ui::WindowAndroid*>(window_android));
1870 return reinterpret_cast<intptr_t>(view); 1871 return reinterpret_cast<intptr_t>(view);
1871 } 1872 }
1872 1873
1873 bool RegisterContentViewCore(JNIEnv* env) { 1874 bool RegisterContentViewCore(JNIEnv* env) {
1874 return RegisterNativesImpl(env); 1875 return RegisterNativesImpl(env);
1875 } 1876 }
1876 1877
1877 } // namespace content 1878 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/renderer_host/input/gesture_event_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698