| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/common/input/synthetic_pointer_action_params.h" | 5 #include "content/common/input/synthetic_pointer_action_params.h" |
| 6 | 6 |
| 7 namespace content { | 7 namespace content { |
| 8 | 8 |
| 9 SyntheticPointerActionParams::SyntheticPointerActionParams() | 9 SyntheticPointerActionParams::SyntheticPointerActionParams() |
| 10 : pointer_action_type_(PointerActionType::NOT_INITIALIZED), index_(0) {} | 10 : pointer_action_type_(PointerActionType::NOT_INITIALIZED), |
| 11 index_(0), |
| 12 button_(Button::LEFT) {} |
| 11 | 13 |
| 12 SyntheticPointerActionParams::SyntheticPointerActionParams( | 14 SyntheticPointerActionParams::SyntheticPointerActionParams( |
| 13 PointerActionType action_type) | 15 PointerActionType action_type) |
| 14 : pointer_action_type_(action_type), index_(0) {} | 16 : pointer_action_type_(action_type), index_(0), button_(Button::LEFT) {} |
| 15 | 17 |
| 16 SyntheticPointerActionParams::~SyntheticPointerActionParams() {} | 18 SyntheticPointerActionParams::~SyntheticPointerActionParams() {} |
| 17 | 19 |
| 20 // static |
| 21 unsigned SyntheticPointerActionParams::GetWebMouseEventModifier( |
| 22 SyntheticPointerActionParams::Button button) { |
| 23 switch (button) { |
| 24 case SyntheticPointerActionParams::Button::LEFT: |
| 25 return blink::WebMouseEvent::LeftButtonDown; |
| 26 case SyntheticPointerActionParams::Button::MIDDLE: |
| 27 return blink::WebMouseEvent::MiddleButtonDown; |
| 28 case SyntheticPointerActionParams::Button::RIGHT: |
| 29 return blink::WebMouseEvent::RightButtonDown; |
| 30 } |
| 31 NOTREACHED(); |
| 32 return blink::WebMouseEvent::NoModifiers; |
| 33 } |
| 34 |
| 35 // static |
| 36 blink::WebMouseEvent::Button |
| 37 SyntheticPointerActionParams::GetWebMouseEventButton( |
| 38 SyntheticPointerActionParams::Button button) { |
| 39 switch (button) { |
| 40 case SyntheticPointerActionParams::Button::LEFT: |
| 41 return blink::WebMouseEvent::Button::Left; |
| 42 case SyntheticPointerActionParams::Button::MIDDLE: |
| 43 return blink::WebMouseEvent::Button::Middle; |
| 44 case SyntheticPointerActionParams::Button::RIGHT: |
| 45 return blink::WebMouseEvent::Button::Right; |
| 46 } |
| 47 NOTREACHED(); |
| 48 return blink::WebMouseEvent::Button::NoButton; |
| 49 } |
| 50 |
| 18 } // namespace content | 51 } // namespace content |
| OLD | NEW |