Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: content/browser/renderer_host/ui_events_helper.cc

Issue 2234023002: Refactor WebInputEventAura to ui/events/blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ui_events_helper.h" 5 #include "content/browser/renderer_host/ui_events_helper.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "content/browser/renderer_host/input/web_input_event_util.h"
10 #include "content/common/input/web_touch_event_traits.h" 9 #include "content/common/input/web_touch_event_traits.h"
11 #include "third_party/WebKit/public/web/WebInputEvent.h" 10 #include "third_party/WebKit/public/web/WebInputEvent.h"
12 #include "ui/events/base_event_utils.h" 11 #include "ui/events/base_event_utils.h"
12 #include "ui/events/blink/blink_event_util.h"
13 #include "ui/events/event.h" 13 #include "ui/events/event.h"
14 #include "ui/events/event_constants.h" 14 #include "ui/events/event_constants.h"
15 15
16 namespace { 16 namespace {
17 17
18 ui::EventType WebTouchPointStateToEventType( 18 ui::EventType WebTouchPointStateToEventType(
19 blink::WebTouchPoint::State state) { 19 blink::WebTouchPoint::State state) {
20 switch (state) { 20 switch (state) {
21 case blink::WebTouchPoint::StateReleased: 21 case blink::WebTouchPoint::StateReleased:
22 return ui::ET_TOUCH_RELEASED; 22 return ui::ET_TOUCH_RELEASED;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 type = ui::ET_TOUCH_MOVED; 56 type = ui::ET_TOUCH_MOVED;
57 break; 57 break;
58 case blink::WebInputEvent::TouchCancel: 58 case blink::WebInputEvent::TouchCancel:
59 type = ui::ET_TOUCH_CANCELLED; 59 type = ui::ET_TOUCH_CANCELLED;
60 break; 60 break;
61 default: 61 default:
62 NOTREACHED(); 62 NOTREACHED();
63 return false; 63 return false;
64 } 64 }
65 65
66 int flags = WebEventModifiersToEventFlags(touch.modifiers); 66 int flags = ui::WebEventModifiersToEventFlags(touch.modifiers);
67 base::TimeTicks timestamp = 67 base::TimeTicks timestamp =
68 ui::EventTimeStampFromSeconds(touch.timeStampSeconds); 68 ui::EventTimeStampFromSeconds(touch.timeStampSeconds);
69 for (unsigned i = 0; i < touch.touchesLength; ++i) { 69 for (unsigned i = 0; i < touch.touchesLength; ++i) {
70 const blink::WebTouchPoint& point = touch.touches[i]; 70 const blink::WebTouchPoint& point = touch.touches[i];
71 if (WebTouchPointStateToEventType(point.state) != type) 71 if (WebTouchPointStateToEventType(point.state) != type)
72 continue; 72 continue;
73 // ui events start in the co-ordinate space of the EventDispatcher. 73 // ui events start in the co-ordinate space of the EventDispatcher.
74 gfx::PointF location; 74 gfx::PointF location;
75 if (coordinate_system == LOCAL_COORDINATES) 75 if (coordinate_system == LOCAL_COORDINATES)
76 location = point.position; 76 location = point.position;
77 else 77 else
78 location = point.screenPosition; 78 location = point.screenPosition;
79 ui::TouchEvent* uievent = new ui::TouchEvent( 79 ui::TouchEvent* uievent = new ui::TouchEvent(
80 type, gfx::Point(), flags, point.id, timestamp, point.radiusX, 80 type, gfx::Point(), flags, point.id, timestamp, point.radiusX,
81 point.radiusY, point.rotationAngle, point.force); 81 point.radiusY, point.rotationAngle, point.force);
82 uievent->set_location_f(location); 82 uievent->set_location_f(location);
83 uievent->set_root_location_f(location); 83 uievent->set_root_location_f(location);
84 uievent->set_latency(touch_with_latency.latency); 84 uievent->set_latency(touch_with_latency.latency);
85 list->push_back(uievent); 85 list->push_back(uievent);
86 } 86 }
87 return true; 87 return true;
88 } 88 }
89 89
90 } // namespace content 90 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698