OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "sky/shell/ui/input_event_converter.h" | 5 #include "sky/shell/ui/input_event_converter.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "sky/engine/public/platform/WebInputEvent.h" | 9 #include "sky/engine/public/platform/WebInputEvent.h" |
10 | 10 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 if (event->gesture_data) { | 98 if (event->gesture_data) { |
99 web_event->primaryPointer = event->gesture_data->primary_pointer; | 99 web_event->primaryPointer = event->gesture_data->primary_pointer; |
100 web_event->x = event->gesture_data->x / device_pixel_ratio; | 100 web_event->x = event->gesture_data->x / device_pixel_ratio; |
101 web_event->y = event->gesture_data->y / device_pixel_ratio; | 101 web_event->y = event->gesture_data->y / device_pixel_ratio; |
102 } | 102 } |
103 | 103 |
104 return web_event.Pass(); | 104 return web_event.Pass(); |
105 } | 105 } |
106 | 106 |
| 107 scoped_ptr<blink::WebInputEvent> BuildWebBackEvent(const InputEventPtr& event) { |
| 108 scoped_ptr<blink::WebInputEvent> web_event(blink::WebInputEvent::create()); |
| 109 web_event->type = blink::WebInputEvent::Back; |
| 110 return web_event.Pass(); |
| 111 } |
| 112 |
107 } // namespace | 113 } // namespace |
108 | 114 |
109 scoped_ptr<blink::WebInputEvent> ConvertEvent(const InputEventPtr& event, | 115 scoped_ptr<blink::WebInputEvent> ConvertEvent(const InputEventPtr& event, |
110 float device_pixel_ratio) { | 116 float device_pixel_ratio) { |
111 switch (event->type) { | 117 switch (event->type) { |
112 case EVENT_TYPE_POINTER_DOWN: | 118 case EVENT_TYPE_POINTER_DOWN: |
113 case EVENT_TYPE_POINTER_UP: | 119 case EVENT_TYPE_POINTER_UP: |
114 case EVENT_TYPE_POINTER_MOVE: | 120 case EVENT_TYPE_POINTER_MOVE: |
115 case EVENT_TYPE_POINTER_CANCEL: | 121 case EVENT_TYPE_POINTER_CANCEL: |
116 return BuildWebPointerEvent(event, device_pixel_ratio); | 122 return BuildWebPointerEvent(event, device_pixel_ratio); |
117 case EVENT_TYPE_GESTURE_FLING_CANCEL: | 123 case EVENT_TYPE_GESTURE_FLING_CANCEL: |
118 case EVENT_TYPE_GESTURE_FLING_START: | 124 case EVENT_TYPE_GESTURE_FLING_START: |
119 case EVENT_TYPE_GESTURE_LONG_PRESS: | 125 case EVENT_TYPE_GESTURE_LONG_PRESS: |
120 case EVENT_TYPE_GESTURE_SCROLL_BEGIN: | 126 case EVENT_TYPE_GESTURE_SCROLL_BEGIN: |
121 case EVENT_TYPE_GESTURE_SCROLL_END: | 127 case EVENT_TYPE_GESTURE_SCROLL_END: |
122 case EVENT_TYPE_GESTURE_SCROLL_UPDATE: | 128 case EVENT_TYPE_GESTURE_SCROLL_UPDATE: |
123 case EVENT_TYPE_GESTURE_SHOW_PRESS: | 129 case EVENT_TYPE_GESTURE_SHOW_PRESS: |
124 case EVENT_TYPE_GESTURE_TAP: | 130 case EVENT_TYPE_GESTURE_TAP: |
125 case EVENT_TYPE_GESTURE_TAP_DOWN: | 131 case EVENT_TYPE_GESTURE_TAP_DOWN: |
126 return BuildWebGestureEvent(event, device_pixel_ratio); | 132 return BuildWebGestureEvent(event, device_pixel_ratio); |
| 133 case EVENT_TYPE_BACK: |
| 134 return BuildWebBackEvent(event); |
127 case EVENT_TYPE_UNKNOWN: | 135 case EVENT_TYPE_UNKNOWN: |
128 NOTIMPLEMENTED() << "ConvertEvent received unexpected EVENT_TYPE_UNKNOWN"; | 136 NOTIMPLEMENTED() << "ConvertEvent received unexpected EVENT_TYPE_UNKNOWN"; |
129 } | 137 } |
130 | 138 |
131 return scoped_ptr<blink::WebInputEvent>(); | 139 return scoped_ptr<blink::WebInputEvent>(); |
132 } | 140 } |
133 | 141 |
134 } // namespace mojo | 142 } // namespace mojo |
OLD | NEW |