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/event_factory_evdev.h" | 5 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <linux/input.h> | 8 #include <linux/input.h> |
9 | 9 |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 break; | 191 break; |
192 case DeviceEvent::REMOVE: { | 192 case DeviceEvent::REMOVE: { |
193 TRACE_EVENT1("ozone", "OnDeviceRemoved", "path", event.path().value()); | 193 TRACE_EVENT1("ozone", "OnDeviceRemoved", "path", event.path().value()); |
194 DetachInputDevice(event.path()); | 194 DetachInputDevice(event.path()); |
195 } | 195 } |
196 break; | 196 break; |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 void EventFactoryEvdev::OnDispatcherListChanged() { | 200 void EventFactoryEvdev::OnDispatcherListChanged() { |
201 if (!ui_task_runner_) { | 201 if (!ui_task_runner_.get()) { |
202 ui_task_runner_ = base::ThreadTaskRunnerHandle::Get(); | 202 ui_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
203 // Scan & monitor devices. | 203 // Scan & monitor devices. |
204 device_manager_->AddObserver(this); | 204 device_manager_->AddObserver(this); |
205 device_manager_->ScanDevices(this); | 205 device_manager_->ScanDevices(this); |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
209 void EventFactoryEvdev::DetachInputDevice(const base::FilePath& path) { | 209 void EventFactoryEvdev::DetachInputDevice(const base::FilePath& path) { |
210 TRACE_EVENT1("ozone", "DetachInputDevice", "path", path.value()); | 210 TRACE_EVENT1("ozone", "DetachInputDevice", "path", path.value()); |
211 CHECK(ui_task_runner_->RunsTasksOnCurrentThread()); | 211 CHECK(ui_task_runner_->RunsTasksOnCurrentThread()); |
(...skipping 22 matching lines...) Expand all Loading... |
234 MouseEvent mouse_event(ET_MOUSE_MOVED, | 234 MouseEvent mouse_event(ET_MOUSE_MOVED, |
235 cursor_->location(), | 235 cursor_->location(), |
236 cursor_->location(), | 236 cursor_->location(), |
237 modifiers_.GetModifierFlags(), | 237 modifiers_.GetModifierFlags(), |
238 /* changed_button_flags */ 0); | 238 /* changed_button_flags */ 0); |
239 DispatchEvent(&mouse_event); | 239 DispatchEvent(&mouse_event); |
240 } | 240 } |
241 } | 241 } |
242 | 242 |
243 } // namespace ui | 243 } // namespace ui |
OLD | NEW |