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/ui_events_helper.h" | 5 #include "content/browser/renderer_host/ui_events_helper.h" |
6 | 6 |
7 #include "content/common/input/web_touch_event_traits.h" | 7 #include "content/common/input/web_touch_event_traits.h" |
8 #include "third_party/WebKit/public/web/WebInputEvent.h" | 8 #include "third_party/WebKit/public/web/WebInputEvent.h" |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 #include "ui/events/event_constants.h" | 10 #include "ui/events/event_constants.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 int EventFlagsToWebEventModifiers(int flags) { | 243 int EventFlagsToWebEventModifiers(int flags) { |
244 int modifiers = 0; | 244 int modifiers = 0; |
245 | 245 |
246 if (flags & ui::EF_SHIFT_DOWN) | 246 if (flags & ui::EF_SHIFT_DOWN) |
247 modifiers |= blink::WebInputEvent::ShiftKey; | 247 modifiers |= blink::WebInputEvent::ShiftKey; |
248 if (flags & ui::EF_CONTROL_DOWN) | 248 if (flags & ui::EF_CONTROL_DOWN) |
249 modifiers |= blink::WebInputEvent::ControlKey; | 249 modifiers |= blink::WebInputEvent::ControlKey; |
250 if (flags & ui::EF_ALT_DOWN) | 250 if (flags & ui::EF_ALT_DOWN) |
251 modifiers |= blink::WebInputEvent::AltKey; | 251 modifiers |= blink::WebInputEvent::AltKey; |
252 // TODO(beng): MetaKey/META_MASK | 252 // TODO(beng): MetaKey/META_MASK |
| 253 #if defined(OS_CHROMEOS) |
| 254 if (flags & ui::EF_COMMAND_DOWN) |
| 255 modifiers |= blink::WebInputEvent::MetaKey; |
| 256 #endif |
253 if (flags & ui::EF_LEFT_MOUSE_BUTTON) | 257 if (flags & ui::EF_LEFT_MOUSE_BUTTON) |
254 modifiers |= blink::WebInputEvent::LeftButtonDown; | 258 modifiers |= blink::WebInputEvent::LeftButtonDown; |
255 if (flags & ui::EF_MIDDLE_MOUSE_BUTTON) | 259 if (flags & ui::EF_MIDDLE_MOUSE_BUTTON) |
256 modifiers |= blink::WebInputEvent::MiddleButtonDown; | 260 modifiers |= blink::WebInputEvent::MiddleButtonDown; |
257 if (flags & ui::EF_RIGHT_MOUSE_BUTTON) | 261 if (flags & ui::EF_RIGHT_MOUSE_BUTTON) |
258 modifiers |= blink::WebInputEvent::RightButtonDown; | 262 modifiers |= blink::WebInputEvent::RightButtonDown; |
259 if (flags & ui::EF_CAPS_LOCK_DOWN) | 263 if (flags & ui::EF_CAPS_LOCK_DOWN) |
260 modifiers |= blink::WebInputEvent::CapsLockOn; | 264 modifiers |= blink::WebInputEvent::CapsLockOn; |
261 return modifiers; | 265 return modifiers; |
262 } | 266 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // Update the type of the touch event. | 332 // Update the type of the touch event. |
329 WebTouchEventTraits::ResetType(TouchEventTypeFromEvent(event), | 333 WebTouchEventTraits::ResetType(TouchEventTypeFromEvent(event), |
330 event.time_stamp().InSecondsF(), | 334 event.time_stamp().InSecondsF(), |
331 web_event); | 335 web_event); |
332 web_event->modifiers = EventFlagsToWebEventModifiers(event.flags()); | 336 web_event->modifiers = EventFlagsToWebEventModifiers(event.flags()); |
333 | 337 |
334 return point; | 338 return point; |
335 } | 339 } |
336 | 340 |
337 } // namespace content | 341 } // namespace content |
OLD | NEW |