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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
7 | 7 |
8 #include "content/browser/renderer_host/input/motion_event_web.h" | 8 #include "content/browser/renderer_host/input/motion_event_web.h" |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "content/browser/renderer_host/input/web_input_event_util.h" |
13 #include "content/common/input/web_touch_event_traits.h" | 14 #include "content/common/input/web_touch_event_traits.h" |
14 | 15 |
15 using blink::WebInputEvent; | 16 using blink::WebInputEvent; |
16 using blink::WebTouchEvent; | 17 using blink::WebTouchEvent; |
17 using blink::WebTouchPoint; | 18 using blink::WebTouchPoint; |
18 | 19 |
19 namespace content { | 20 namespace content { |
20 namespace { | 21 namespace { |
21 | 22 |
22 ui::MotionEvent::Action GetActionFrom(const WebTouchEvent& event) { | 23 ui::MotionEvent::Action GetActionFrom(const WebTouchEvent& event) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // TODO(jdduke): Plumb tool type from the platform event, crbug.com/404128. | 152 // TODO(jdduke): Plumb tool type from the platform event, crbug.com/404128. |
152 DCHECK_LT(pointer_index, GetPointerCount()); | 153 DCHECK_LT(pointer_index, GetPointerCount()); |
153 return TOOL_TYPE_UNKNOWN; | 154 return TOOL_TYPE_UNKNOWN; |
154 } | 155 } |
155 | 156 |
156 int MotionEventWeb::GetButtonState() const { | 157 int MotionEventWeb::GetButtonState() const { |
157 NOTIMPLEMENTED(); | 158 NOTIMPLEMENTED(); |
158 return 0; | 159 return 0; |
159 } | 160 } |
160 | 161 |
| 162 int MotionEventWeb::GetFlags() const { |
| 163 return WebEventModifiersToEventFlags(event_.modifiers); |
| 164 } |
| 165 |
161 scoped_ptr<ui::MotionEvent> MotionEventWeb::Clone() const { | 166 scoped_ptr<ui::MotionEvent> MotionEventWeb::Clone() const { |
162 return scoped_ptr<MotionEvent>(new MotionEventWeb(event_)); | 167 return scoped_ptr<MotionEvent>(new MotionEventWeb(event_)); |
163 } | 168 } |
164 | 169 |
165 scoped_ptr<ui::MotionEvent> MotionEventWeb::Cancel() const { | 170 scoped_ptr<ui::MotionEvent> MotionEventWeb::Cancel() const { |
166 WebTouchEvent cancel_event(event_); | 171 WebTouchEvent cancel_event(event_); |
167 WebTouchEventTraits::ResetTypeAndTouchStates( | 172 WebTouchEventTraits::ResetTypeAndTouchStates( |
168 blink::WebInputEvent::TouchCancel, | 173 blink::WebInputEvent::TouchCancel, |
169 // TODO(rbyers): Shouldn't we use a fresh timestamp? | 174 // TODO(rbyers): Shouldn't we use a fresh timestamp? |
170 event_.timeStampSeconds, | 175 event_.timeStampSeconds, |
171 &cancel_event); | 176 &cancel_event); |
172 return scoped_ptr<MotionEvent>(new MotionEventWeb(cancel_event)); | 177 return scoped_ptr<MotionEvent>(new MotionEventWeb(cancel_event)); |
173 } | 178 } |
174 | 179 |
175 } // namespace content | 180 } // namespace content |
OLD | NEW |