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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 ui::GestureStatus RenderWidgetHostViewAura::OnGestureEvent( | 1142 ui::GestureStatus RenderWidgetHostViewAura::OnGestureEvent( |
1143 aura::GestureEvent* event) { | 1143 aura::GestureEvent* event) { |
1144 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnGestureEvent"); | 1144 TRACE_EVENT0("browser", "RenderWidgetHostViewAura::OnGestureEvent"); |
1145 // Pinch gestures are currently disabled by default. See crbug.com/128477. | 1145 // Pinch gestures are currently disabled by default. See crbug.com/128477. |
1146 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || | 1146 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || |
1147 event->type() == ui::ET_GESTURE_PINCH_UPDATE || | 1147 event->type() == ui::ET_GESTURE_PINCH_UPDATE || |
1148 event->type() == ui::ET_GESTURE_PINCH_END) && !ShouldSendPinchGesture()) { | 1148 event->type() == ui::ET_GESTURE_PINCH_END) && !ShouldSendPinchGesture()) { |
1149 return ui::GESTURE_STATUS_CONSUMED; | 1149 return ui::GESTURE_STATUS_CONSUMED; |
1150 } | 1150 } |
1151 | 1151 |
1152 RenderViewHostDelegate* delegate = RenderViewHost::From(host_)->GetDelegate(); | 1152 RenderViewHostDelegate* delegate = NULL; |
1153 if (event->type() == ui::ET_GESTURE_BEGIN && | 1153 if (popup_type_ == WebKit::WebPopupTypeNone) |
| 1154 delegate = RenderViewHost::From(host_)->GetDelegate(); |
| 1155 if (delegate && event->type() == ui::ET_GESTURE_BEGIN && |
1154 event->details().touch_points() == 1) { | 1156 event->details().touch_points() == 1) { |
1155 delegate->HandleGestureBegin(); | 1157 delegate->HandleGestureBegin(); |
1156 } | 1158 } |
1157 | 1159 |
1158 WebKit::WebGestureEvent gesture = MakeWebGestureEvent(event); | 1160 WebKit::WebGestureEvent gesture = MakeWebGestureEvent(event); |
1159 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { | 1161 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { |
1160 // Webkit does not stop a fling-scroll on tap-down. So explicitly send an | 1162 // Webkit does not stop a fling-scroll on tap-down. So explicitly send an |
1161 // event to stop any in-progress flings. | 1163 // event to stop any in-progress flings. |
1162 WebKit::WebGestureEvent fling_cancel = gesture; | 1164 WebKit::WebGestureEvent fling_cancel = gesture; |
1163 fling_cancel.type = WebKit::WebInputEvent::GestureFlingCancel; | 1165 fling_cancel.type = WebKit::WebInputEvent::GestureFlingCancel; |
1164 host_->ForwardGestureEvent(fling_cancel); | 1166 host_->ForwardGestureEvent(fling_cancel); |
1165 } | 1167 } |
1166 | 1168 |
1167 if (gesture.type != WebKit::WebInputEvent::Undefined) { | 1169 if (gesture.type != WebKit::WebInputEvent::Undefined) { |
1168 host_->ForwardGestureEvent(gesture); | 1170 host_->ForwardGestureEvent(gesture); |
1169 | 1171 |
1170 if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN || | 1172 if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN || |
1171 event->type() == ui::ET_GESTURE_SCROLL_UPDATE || | 1173 event->type() == ui::ET_GESTURE_SCROLL_UPDATE || |
1172 event->type() == ui::ET_GESTURE_SCROLL_END) { | 1174 event->type() == ui::ET_GESTURE_SCROLL_END) { |
1173 RecordAction(UserMetricsAction("TouchscreenScroll")); | 1175 RecordAction(UserMetricsAction("TouchscreenScroll")); |
1174 } else if (event->type() == ui::ET_SCROLL_FLING_START) { | 1176 } else if (event->type() == ui::ET_SCROLL_FLING_START) { |
1175 RecordAction(UserMetricsAction("TouchscreenScrollFling")); | 1177 RecordAction(UserMetricsAction("TouchscreenScrollFling")); |
1176 } | 1178 } |
1177 } | 1179 } |
1178 | 1180 |
1179 if (event->type() == ui::ET_GESTURE_END && | 1181 if (delegate && event->type() == ui::ET_GESTURE_END && |
1180 event->details().touch_points() == 1) { | 1182 event->details().touch_points() == 1) { |
1181 delegate->HandleGestureEnd(); | 1183 delegate->HandleGestureEnd(); |
1182 } | 1184 } |
1183 | 1185 |
1184 // If a gesture is not processed by the webpage, then WebKit processes it | 1186 // If a gesture is not processed by the webpage, then WebKit processes it |
1185 // (e.g. generates synthetic mouse events). So CONSUMED should be returned | 1187 // (e.g. generates synthetic mouse events). So CONSUMED should be returned |
1186 // from here to avoid any duplicate synthetic mouse-events being generated | 1188 // from here to avoid any duplicate synthetic mouse-events being generated |
1187 // from aura. | 1189 // from aura. |
1188 return ui::GESTURE_STATUS_CONSUMED; | 1190 return ui::GESTURE_STATUS_CONSUMED; |
1189 } | 1191 } |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 RenderWidgetHost* widget) { | 1494 RenderWidgetHost* widget) { |
1493 return new RenderWidgetHostViewAura(widget); | 1495 return new RenderWidgetHostViewAura(widget); |
1494 } | 1496 } |
1495 | 1497 |
1496 // static | 1498 // static |
1497 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1499 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1498 GetScreenInfoForWindow(results, NULL); | 1500 GetScreenInfoForWindow(results, NULL); |
1499 } | 1501 } |
1500 | 1502 |
1501 } // namespace content | 1503 } // namespace content |
OLD | NEW |