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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 | 152 |
153 std::unique_ptr<SystemInputInjector> | 153 std::unique_ptr<SystemInputInjector> |
154 EventFactoryEvdev::CreateSystemInputInjector() { | 154 EventFactoryEvdev::CreateSystemInputInjector() { |
155 // Use forwarding dispatcher for the injector rather than dispatching | 155 // Use forwarding dispatcher for the injector rather than dispatching |
156 // directly. We cannot assume it is safe to (re-)enter ui::Event dispatch | 156 // directly. We cannot assume it is safe to (re-)enter ui::Event dispatch |
157 // synchronously from the injection point. | 157 // synchronously from the injection point. |
158 std::unique_ptr<DeviceEventDispatcherEvdev> proxy_dispatcher( | 158 std::unique_ptr<DeviceEventDispatcherEvdev> proxy_dispatcher( |
159 new ProxyDeviceEventDispatcher(base::ThreadTaskRunnerHandle::Get(), | 159 new ProxyDeviceEventDispatcher(base::ThreadTaskRunnerHandle::Get(), |
160 weak_ptr_factory_.GetWeakPtr())); | 160 weak_ptr_factory_.GetWeakPtr())); |
161 return base::WrapUnique( | 161 return base::MakeUnique<InputInjectorEvdev>(std::move(proxy_dispatcher), |
162 new InputInjectorEvdev(std::move(proxy_dispatcher), cursor_)); | 162 cursor_); |
163 } | 163 } |
164 | 164 |
165 void EventFactoryEvdev::DispatchKeyEvent(const KeyEventParams& params) { | 165 void EventFactoryEvdev::DispatchKeyEvent(const KeyEventParams& params) { |
166 TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchKeyEvent", "device", | 166 TRACE_EVENT1("evdev", "EventFactoryEvdev::DispatchKeyEvent", "device", |
167 params.device_id); | 167 params.device_id); |
168 keyboard_.OnKeyChange(params.code, params.down, params.suppress_auto_repeat, | 168 keyboard_.OnKeyChange(params.code, params.down, params.suppress_auto_repeat, |
169 params.timestamp, params.device_id); | 169 params.timestamp, params.device_id); |
170 } | 170 } |
171 | 171 |
172 void EventFactoryEvdev::DispatchMouseMoveEvent( | 172 void EventFactoryEvdev::DispatchMouseMoveEvent( |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 425 |
426 // Scan & monitor devices. | 426 // Scan & monitor devices. |
427 device_manager_->AddObserver(this); | 427 device_manager_->AddObserver(this); |
428 device_manager_->ScanDevices(this); | 428 device_manager_->ScanDevices(this); |
429 | 429 |
430 // Notify device thread that initial scan is done. | 430 // Notify device thread that initial scan is done. |
431 input_device_factory_proxy_->OnStartupScanComplete(); | 431 input_device_factory_proxy_->OnStartupScanComplete(); |
432 } | 432 } |
433 | 433 |
434 } // namespace ui | 434 } // namespace ui |
OLD | NEW |