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

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

Issue 170673005: [Android] More eager gesture recognition hardening (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add type DCHECK 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
« no previous file with comments | « no previous file | content/browser/renderer_host/input/gesture_event_packet.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 handling_touch_event_ = true; 1023 handling_touch_event_ = true;
1024 1024
1025 pending_touch_event_ = 1025 pending_touch_event_ =
1026 WebTouchEventBuilder::Build(motion_event, GetDpiScale()); 1026 WebTouchEventBuilder::Build(motion_event, GetDpiScale());
1027 1027
1028 pending_gesture_packet_ = 1028 pending_gesture_packet_ =
1029 GestureEventPacket::FromTouch(pending_touch_event_); 1029 GestureEventPacket::FromTouch(pending_touch_event_);
1030 } 1030 }
1031 1031
1032 void ContentViewCoreImpl::OnTouchEventHandlingEnd(JNIEnv* env, jobject obj) { 1032 void ContentViewCoreImpl::OnTouchEventHandlingEnd(JNIEnv* env, jobject obj) {
1033 DCHECK(handling_touch_event_); 1033 if (!handling_touch_event_)
1034 return;
1035
1036 GestureEventPacket gesture_packet;
1037 std::swap(gesture_packet, pending_gesture_packet_);
1038
1034 handling_touch_event_ = false; 1039 handling_touch_event_ = false;
1035 1040
1036 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); 1041 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
1037 if (!rwhv) 1042 if (!rwhv)
1038 return; 1043 return;
1039 1044
1040 // Note: Order is important here, as the touch may be ack'ed synchronously 1045 // Note: Order is important here, as the touch may be ack'ed synchronously
1041 TouchDispositionGestureFilter::PacketResult result = 1046 TouchDispositionGestureFilter::PacketResult result =
1042 touch_disposition_gesture_filter_.OnGestureEventPacket( 1047 touch_disposition_gesture_filter_.OnGestureEventPacket(gesture_packet);
1043 pending_gesture_packet_);
1044 if (result != TouchDispositionGestureFilter::SUCCESS) { 1048 if (result != TouchDispositionGestureFilter::SUCCESS) {
1045 NOTREACHED() << "Invalid touch gesture sequence detected."; 1049 NOTREACHED() << "Invalid touch gesture sequence detected.";
1046 return; 1050 return;
1047 } 1051 }
1048 rwhv->SendTouchEvent(pending_touch_event_); 1052 rwhv->SendTouchEvent(pending_touch_event_);
1049 } 1053 }
1050 1054
1051 float ContentViewCoreImpl::GetTouchPaddingDip() { 1055 float ContentViewCoreImpl::GetTouchPaddingDip() {
1052 return 48.0f / GetDpiScale(); 1056 return 48.0f / GetDpiScale();
1053 } 1057 }
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 reinterpret_cast<ui::ViewAndroid*>(view_android), 1865 reinterpret_cast<ui::ViewAndroid*>(view_android),
1862 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1866 reinterpret_cast<ui::WindowAndroid*>(window_android));
1863 return reinterpret_cast<intptr_t>(view); 1867 return reinterpret_cast<intptr_t>(view);
1864 } 1868 }
1865 1869
1866 bool RegisterContentViewCore(JNIEnv* env) { 1870 bool RegisterContentViewCore(JNIEnv* env) {
1867 return RegisterNativesImpl(env); 1871 return RegisterNativesImpl(env);
1868 } 1872 }
1869 1873
1870 } // namespace content 1874 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/gesture_event_packet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698