| 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> | |
| 8 #include <linux/input.h> | 7 #include <linux/input.h> |
| 9 | 8 |
| 9 #include <algorithm> |
| 10 |
| 11 #include "base/memory/ptr_util.h" |
| 10 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 11 #include "ui/events/devices/device_data_manager.h" | 13 #include "ui/events/devices/device_data_manager.h" |
| 12 #include "ui/events/ozone/evdev/input_device_factory_evdev_proxy.h" | 14 #include "ui/events/ozone/evdev/input_device_factory_evdev_proxy.h" |
| 13 #include "ui/events/ozone/evdev/keyboard_evdev.h" | 15 #include "ui/events/ozone/evdev/keyboard_evdev.h" |
| 14 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" | 16 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" |
| 15 | 17 |
| 16 namespace ui { | 18 namespace ui { |
| 17 | 19 |
| 18 InputControllerEvdev::InputControllerEvdev(KeyboardEvdev* keyboard, | 20 InputControllerEvdev::InputControllerEvdev(KeyboardEvdev* keyboard, |
| 19 MouseButtonMapEvdev* button_map) | 21 MouseButtonMapEvdev* button_map) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void InputControllerEvdev::SetTapToClickPaused(bool state) { | 156 void InputControllerEvdev::SetTapToClickPaused(bool state) { |
| 155 input_device_settings_.tap_to_click_paused = state; | 157 input_device_settings_.tap_to_click_paused = state; |
| 156 ScheduleUpdateDeviceSettings(); | 158 ScheduleUpdateDeviceSettings(); |
| 157 } | 159 } |
| 158 | 160 |
| 159 void InputControllerEvdev::GetTouchDeviceStatus( | 161 void InputControllerEvdev::GetTouchDeviceStatus( |
| 160 const GetTouchDeviceStatusReply& reply) { | 162 const GetTouchDeviceStatusReply& reply) { |
| 161 if (input_device_factory_) | 163 if (input_device_factory_) |
| 162 input_device_factory_->GetTouchDeviceStatus(reply); | 164 input_device_factory_->GetTouchDeviceStatus(reply); |
| 163 else | 165 else |
| 164 reply.Run(make_scoped_ptr(new std::string)); | 166 reply.Run(base::WrapUnique(new std::string)); |
| 165 } | 167 } |
| 166 | 168 |
| 167 void InputControllerEvdev::GetTouchEventLog( | 169 void InputControllerEvdev::GetTouchEventLog( |
| 168 const base::FilePath& out_dir, | 170 const base::FilePath& out_dir, |
| 169 const GetTouchEventLogReply& reply) { | 171 const GetTouchEventLogReply& reply) { |
| 170 if (input_device_factory_) | 172 if (input_device_factory_) |
| 171 input_device_factory_->GetTouchEventLog(out_dir, reply); | 173 input_device_factory_->GetTouchEventLog(out_dir, reply); |
| 172 else | 174 else |
| 173 reply.Run(make_scoped_ptr(new std::vector<base::FilePath>)); | 175 reply.Run(base::WrapUnique(new std::vector<base::FilePath>)); |
| 174 } | 176 } |
| 175 | 177 |
| 176 void InputControllerEvdev::ScheduleUpdateDeviceSettings() { | 178 void InputControllerEvdev::ScheduleUpdateDeviceSettings() { |
| 177 if (!input_device_factory_ || settings_update_pending_) | 179 if (!input_device_factory_ || settings_update_pending_) |
| 178 return; | 180 return; |
| 179 base::ThreadTaskRunnerHandle::Get()->PostTask( | 181 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 180 FROM_HERE, base::Bind(&InputControllerEvdev::UpdateDeviceSettings, | 182 FROM_HERE, base::Bind(&InputControllerEvdev::UpdateDeviceSettings, |
| 181 weak_ptr_factory_.GetWeakPtr())); | 183 weak_ptr_factory_.GetWeakPtr())); |
| 182 settings_update_pending_ = true; | 184 settings_update_pending_ = true; |
| 183 } | 185 } |
| 184 | 186 |
| 185 void InputControllerEvdev::UpdateDeviceSettings() { | 187 void InputControllerEvdev::UpdateDeviceSettings() { |
| 186 input_device_factory_->UpdateInputDeviceSettings(input_device_settings_); | 188 input_device_factory_->UpdateInputDeviceSettings(input_device_settings_); |
| 187 settings_update_pending_ = false; | 189 settings_update_pending_ = false; |
| 188 } | 190 } |
| 189 | 191 |
| 190 void InputControllerEvdev::UpdateCapsLockLed() { | 192 void InputControllerEvdev::UpdateCapsLockLed() { |
| 191 if (!input_device_factory_) | 193 if (!input_device_factory_) |
| 192 return; | 194 return; |
| 193 bool caps_lock_state = IsCapsLockEnabled(); | 195 bool caps_lock_state = IsCapsLockEnabled(); |
| 194 if (caps_lock_state != caps_lock_led_state_) | 196 if (caps_lock_state != caps_lock_led_state_) |
| 195 input_device_factory_->SetCapsLockLed(caps_lock_state); | 197 input_device_factory_->SetCapsLockLed(caps_lock_state); |
| 196 caps_lock_led_state_ = caps_lock_state; | 198 caps_lock_led_state_ = caps_lock_state; |
| 197 } | 199 } |
| 198 | 200 |
| 199 } // namespace ui | 201 } // namespace ui |
| OLD | NEW |