OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1133 touch_editing_client_->GestureEventAck(event.type); | 1133 touch_editing_client_->GestureEventAck(event.type); |
1134 | 1134 |
1135 if (overscroll_controller_) { | 1135 if (overscroll_controller_) { |
1136 overscroll_controller_->ReceivedEventACK( | 1136 overscroll_controller_->ReceivedEventACK( |
1137 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); | 1137 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); |
1138 } | 1138 } |
1139 } | 1139 } |
1140 | 1140 |
1141 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( | 1141 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( |
1142 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { | 1142 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { |
1143 ScopedVector<ui::TouchEvent> events; | |
1144 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, | |
1145 SCREEN_COORDINATES)) | |
1146 return; | |
1147 | |
1148 aura::WindowTreeHost* host = window_->GetHost(); | 1143 aura::WindowTreeHost* host = window_->GetHost(); |
1149 // |host| is NULL during tests. | 1144 // |host| is sometimes NULL during tests. |
1150 if (!host) | 1145 if (!host) |
1151 return; | 1146 return; |
1152 | 1147 |
1153 ui::EventResult result = (ack_result == | 1148 ui::EventResult result = (ack_result == |
1154 INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED; | 1149 INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED; |
1155 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), | 1150 |
1156 end = events.end(); iter != end; ++iter) { | 1151 // Only send acks for changed touches. |
1157 host->dispatcher()->ProcessedTouchEvent((*iter), window_, result); | 1152 blink::WebTouchPoint::State required_state; |
1153 switch(touch.event.type) { | |
1154 case blink::WebInputEvent::TouchStart: | |
1155 required_state = blink::WebTouchPoint::StatePressed; | |
1156 break; | |
1157 case blink::WebInputEvent::TouchEnd: | |
1158 required_state = blink::WebTouchPoint::StateReleased; | |
1159 break; | |
1160 case blink::WebInputEvent::TouchMove: | |
1161 required_state = blink::WebTouchPoint::StateMoved; | |
1162 break; | |
1163 case blink::WebInputEvent::TouchCancel: | |
1164 required_state = blink::WebTouchPoint::StateCancelled; | |
1165 break; | |
1166 default: | |
1167 required_state = blink::WebTouchPoint::StateUndefined; | |
1168 DCHECK(false); | |
tdresser
2014/12/03 19:49:52
Should be NOTREACHED().
tdresser
2015/02/06 17:43:49
Done.
| |
1169 break; | |
1170 } | |
1171 | |
1172 for (size_t i = 0; i < touch.event.touchesLength; ++i) { | |
1173 if (touch.event.touches[i].state == required_state) | |
1174 host->dispatcher()->ProcessedTouchEvent(window_, result); | |
1158 } | 1175 } |
1159 } | 1176 } |
1160 | 1177 |
1161 scoped_ptr<SyntheticGestureTarget> | 1178 scoped_ptr<SyntheticGestureTarget> |
1162 RenderWidgetHostViewAura::CreateSyntheticGestureTarget() { | 1179 RenderWidgetHostViewAura::CreateSyntheticGestureTarget() { |
1163 return scoped_ptr<SyntheticGestureTarget>( | 1180 return scoped_ptr<SyntheticGestureTarget>( |
1164 new SyntheticGestureTargetAura(host_)); | 1181 new SyntheticGestureTargetAura(host_)); |
1165 } | 1182 } |
1166 | 1183 |
1167 InputEventAckState RenderWidgetHostViewAura::FilterInputEvent( | 1184 InputEventAckState RenderWidgetHostViewAura::FilterInputEvent( |
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2488 | 2505 |
2489 //////////////////////////////////////////////////////////////////////////////// | 2506 //////////////////////////////////////////////////////////////////////////////// |
2490 // RenderWidgetHostViewBase, public: | 2507 // RenderWidgetHostViewBase, public: |
2491 | 2508 |
2492 // static | 2509 // static |
2493 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2510 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2494 GetScreenInfoForWindow(results, NULL); | 2511 GetScreenInfoForWindow(results, NULL); |
2495 } | 2512 } |
2496 | 2513 |
2497 } // namespace content | 2514 } // namespace content |
OLD | NEW |