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 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 if (touch_editing_client_) | 1156 if (touch_editing_client_) |
1157 touch_editing_client_->GestureEventAck(event.type); | 1157 touch_editing_client_->GestureEventAck(event.type); |
1158 | 1158 |
1159 if (overscroll_controller_) { | 1159 if (overscroll_controller_) { |
1160 overscroll_controller_->ReceivedEventACK( | 1160 overscroll_controller_->ReceivedEventACK( |
1161 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); | 1161 event, (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result)); |
1162 } | 1162 } |
1163 } | 1163 } |
1164 | 1164 |
1165 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( | 1165 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( |
1166 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { | 1166 const TouchEventWithLatencyInfo& touch, |
| 1167 InputEventAckState ack_result) { |
1167 ScopedVector<ui::TouchEvent> events; | 1168 ScopedVector<ui::TouchEvent> events; |
1168 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, | |
1169 SCREEN_COORDINATES)) | |
1170 return; | |
1171 | |
1172 aura::WindowTreeHost* host = window_->GetHost(); | 1169 aura::WindowTreeHost* host = window_->GetHost(); |
1173 // |host| is NULL during tests. | 1170 // |host| is NULL during tests. |
1174 if (!host) | 1171 if (!host) |
1175 return; | 1172 return; |
1176 | 1173 |
1177 ui::EventResult result = (ack_result == | 1174 ui::EventResult result = (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) |
1178 INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED; | 1175 ? ui::ER_HANDLED |
1179 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), | 1176 : ui::ER_UNHANDLED; |
1180 end = events.end(); iter != end; ++iter) { | 1177 |
1181 host->dispatcher()->ProcessedTouchEvent((*iter), window_, result); | 1178 blink::WebTouchPoint::State required_state; |
| 1179 switch (touch.event.type) { |
| 1180 case blink::WebInputEvent::TouchStart: |
| 1181 required_state = blink::WebTouchPoint::StatePressed; |
| 1182 break; |
| 1183 case blink::WebInputEvent::TouchEnd: |
| 1184 required_state = blink::WebTouchPoint::StateReleased; |
| 1185 break; |
| 1186 case blink::WebInputEvent::TouchMove: |
| 1187 required_state = blink::WebTouchPoint::StateMoved; |
| 1188 break; |
| 1189 case blink::WebInputEvent::TouchCancel: |
| 1190 required_state = blink::WebTouchPoint::StateCancelled; |
| 1191 break; |
| 1192 default: |
| 1193 required_state = blink::WebTouchPoint::StateUndefined; |
| 1194 NOTREACHED(); |
| 1195 break; |
| 1196 } |
| 1197 |
| 1198 // Only send acks for changed touches. |
| 1199 for (size_t i = 0; i < touch.event.touchesLength; ++i) { |
| 1200 if (touch.event.touches[i].state == required_state) |
| 1201 host->dispatcher()->ProcessedTouchEvent(window_, result); |
1182 } | 1202 } |
1183 } | 1203 } |
1184 | 1204 |
1185 scoped_ptr<SyntheticGestureTarget> | 1205 scoped_ptr<SyntheticGestureTarget> |
1186 RenderWidgetHostViewAura::CreateSyntheticGestureTarget() { | 1206 RenderWidgetHostViewAura::CreateSyntheticGestureTarget() { |
1187 return scoped_ptr<SyntheticGestureTarget>( | 1207 return scoped_ptr<SyntheticGestureTarget>( |
1188 new SyntheticGestureTargetAura(host_)); | 1208 new SyntheticGestureTargetAura(host_)); |
1189 } | 1209 } |
1190 | 1210 |
1191 InputEventAckState RenderWidgetHostViewAura::FilterInputEvent( | 1211 InputEventAckState RenderWidgetHostViewAura::FilterInputEvent( |
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2659 | 2679 |
2660 //////////////////////////////////////////////////////////////////////////////// | 2680 //////////////////////////////////////////////////////////////////////////////// |
2661 // RenderWidgetHostViewBase, public: | 2681 // RenderWidgetHostViewBase, public: |
2662 | 2682 |
2663 // static | 2683 // static |
2664 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2684 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
2665 GetScreenInfoForWindow(results, NULL); | 2685 GetScreenInfoForWindow(results, NULL); |
2666 } | 2686 } |
2667 | 2687 |
2668 } // namespace content | 2688 } // namespace content |
OLD | NEW |