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/web_input_event_aura.h" | 5 #include "content/browser/renderer_host/web_input_event_aura.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "content/browser/renderer_host/input/web_input_event_util.h" | 8 #include "content/browser/renderer_host/input/web_input_event_util.h" |
9 #include "ui/aura/client/screen_position_client.h" | 9 #include "ui/aura/client/screen_position_client.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 ui::EventPointerType pointer_type) { | 39 ui::EventPointerType pointer_type) { |
40 switch (pointer_type) { | 40 switch (pointer_type) { |
41 case ui::EventPointerType::POINTER_TYPE_UNKNOWN: | 41 case ui::EventPointerType::POINTER_TYPE_UNKNOWN: |
42 return blink::WebPointerProperties::PointerType::Unknown; | 42 return blink::WebPointerProperties::PointerType::Unknown; |
43 case ui::EventPointerType::POINTER_TYPE_MOUSE: | 43 case ui::EventPointerType::POINTER_TYPE_MOUSE: |
44 return blink::WebPointerProperties::PointerType::Mouse; | 44 return blink::WebPointerProperties::PointerType::Mouse; |
45 case ui::EventPointerType::POINTER_TYPE_PEN: | 45 case ui::EventPointerType::POINTER_TYPE_PEN: |
46 return blink::WebPointerProperties::PointerType::Pen; | 46 return blink::WebPointerProperties::PointerType::Pen; |
47 case ui::EventPointerType::POINTER_TYPE_TOUCH: | 47 case ui::EventPointerType::POINTER_TYPE_TOUCH: |
48 return blink::WebPointerProperties::PointerType::Touch; | 48 return blink::WebPointerProperties::PointerType::Touch; |
| 49 default: |
| 50 NOTREACHED() << "Unexpected EventPointerType"; |
| 51 return blink::WebPointerProperties::PointerType::Unknown; |
49 } | 52 } |
50 NOTREACHED() << "Unexpected EventPointerType"; | |
51 return blink::WebPointerProperties::PointerType::Unknown; | |
52 } | 53 } |
53 | 54 |
54 // Creates a WebGestureEvent from a ui::GestureEvent. Note that it does not | 55 // Creates a WebGestureEvent from a ui::GestureEvent. Note that it does not |
55 // populate the event coordinates (i.e. |x|, |y|, |globalX|, and |globalY|). So | 56 // populate the event coordinates (i.e. |x|, |y|, |globalX|, and |globalY|). So |
56 // the caller must populate these fields. | 57 // the caller must populate these fields. |
57 blink::WebGestureEvent MakeWebGestureEventFromUIEvent( | 58 blink::WebGestureEvent MakeWebGestureEventFromUIEvent( |
58 const ui::GestureEvent& event) { | 59 const ui::GestureEvent& event) { |
59 return ui::CreateWebGestureEvent( | 60 return ui::CreateWebGestureEvent( |
60 event.details(), event.time_stamp(), event.location_f(), | 61 event.details(), event.time_stamp(), event.location_f(), |
61 event.root_location_f(), event.flags(), event.unique_touch_event_id()); | 62 event.root_location_f(), event.flags(), event.unique_touch_event_id()); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 webkit_event.tiltX = roundf(event.pointer_details().tilt_x); | 449 webkit_event.tiltX = roundf(event.pointer_details().tilt_x); |
449 webkit_event.tiltY = roundf(event.pointer_details().tilt_y); | 450 webkit_event.tiltY = roundf(event.pointer_details().tilt_y); |
450 webkit_event.force = event.pointer_details().force; | 451 webkit_event.force = event.pointer_details().force; |
451 webkit_event.pointerType = | 452 webkit_event.pointerType = |
452 EventPointerTypeToWebPointerType(event.pointer_details().pointer_type); | 453 EventPointerTypeToWebPointerType(event.pointer_details().pointer_type); |
453 | 454 |
454 return webkit_event; | 455 return webkit_event; |
455 } | 456 } |
456 | 457 |
457 } // namespace content | 458 } // namespace content |
OLD | NEW |