| 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 "ui/events/ozone/evdev/input_controller_evdev.h" | 5 #include "ui/events/ozone/evdev/input_controller_evdev.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <linux/input.h> | 8 #include <linux/input.h> |
| 9 | 9 |
| 10 #include "ui/events/ozone/evdev/input_device_factory_evdev.h" | 10 #include "ui/events/ozone/evdev/input_device_factory_evdev.h" |
| 11 #include "ui/events/ozone/evdev/keyboard_evdev.h" | 11 #include "ui/events/ozone/evdev/keyboard_evdev.h" |
| 12 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" | 12 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 | 15 |
| 16 InputControllerEvdev::InputControllerEvdev(KeyboardEvdev* keyboard, | 16 InputControllerEvdev::InputControllerEvdev(KeyboardEvdev* keyboard, |
| 17 MouseButtonMapEvdev* button_map) | 17 MouseButtonMapEvdev* button_map) |
| 18 : input_device_factory_(nullptr), | 18 : input_device_factory_(nullptr), |
| 19 keyboard_(keyboard), | 19 keyboard_(keyboard), |
| 20 button_map_(button_map) { | 20 button_map_(button_map), |
| 21 has_mouse_(false), |
| 22 has_touchpad_(false) { |
| 21 } | 23 } |
| 22 | 24 |
| 23 InputControllerEvdev::~InputControllerEvdev() { | 25 InputControllerEvdev::~InputControllerEvdev() { |
| 24 } | 26 } |
| 25 | 27 |
| 26 void InputControllerEvdev::SetInputDeviceFactory( | 28 void InputControllerEvdev::SetInputDeviceFactory( |
| 27 InputDeviceFactoryEvdev* input_device_factory) { | 29 InputDeviceFactoryEvdev* input_device_factory) { |
| 28 input_device_factory_ = input_device_factory; | 30 input_device_factory_ = input_device_factory; |
| 29 } | 31 } |
| 30 | 32 |
| 33 void InputControllerEvdev::set_has_mouse(bool has_mouse) { |
| 34 has_mouse_ = has_mouse; |
| 35 } |
| 36 |
| 37 void InputControllerEvdev::set_has_touchpad(bool has_touchpad) { |
| 38 has_touchpad_ = has_touchpad; |
| 39 } |
| 40 |
| 31 bool InputControllerEvdev::HasMouse() { | 41 bool InputControllerEvdev::HasMouse() { |
| 32 if (!input_device_factory_) | 42 return has_mouse_; |
| 33 return false; | |
| 34 return input_device_factory_->HasMouse(); | |
| 35 } | 43 } |
| 36 | 44 |
| 37 bool InputControllerEvdev::HasTouchpad() { | 45 bool InputControllerEvdev::HasTouchpad() { |
| 38 if (!input_device_factory_) | 46 return has_touchpad_; |
| 39 return false; | |
| 40 return input_device_factory_->HasTouchpad(); | |
| 41 } | 47 } |
| 42 | 48 |
| 43 bool InputControllerEvdev::IsCapsLockEnabled() { | 49 bool InputControllerEvdev::IsCapsLockEnabled() { |
| 44 return keyboard_->IsCapsLockEnabled(); | 50 return keyboard_->IsCapsLockEnabled(); |
| 45 } | 51 } |
| 46 | 52 |
| 47 void InputControllerEvdev::SetCapsLockEnabled(bool enabled) { | 53 void InputControllerEvdev::SetCapsLockEnabled(bool enabled) { |
| 48 keyboard_->SetCapsLockEnabled(enabled); | 54 keyboard_->SetCapsLockEnabled(enabled); |
| 49 } | 55 } |
| 50 | 56 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 141 |
| 136 void InputControllerEvdev::GetTouchDeviceStatus( | 142 void InputControllerEvdev::GetTouchDeviceStatus( |
| 137 const GetTouchDeviceStatusReply& reply) { | 143 const GetTouchDeviceStatusReply& reply) { |
| 138 if (input_device_factory_) | 144 if (input_device_factory_) |
| 139 input_device_factory_->GetTouchDeviceStatus(reply); | 145 input_device_factory_->GetTouchDeviceStatus(reply); |
| 140 else | 146 else |
| 141 reply.Run(make_scoped_ptr(new std::string)); | 147 reply.Run(make_scoped_ptr(new std::string)); |
| 142 } | 148 } |
| 143 | 149 |
| 144 } // namespace ui | 150 } // namespace ui |
| OLD | NEW |