Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: ui/events/ozone/evdev/event_factory_evdev.cc

Issue 882503002: [PATCH 9.2/11] ozone: evdev: Use DeviceEventDispatcherEvdev from InputInjectorEvdev (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/events/ozone/evdev/input_injector_evdev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/task_runner.h" 9 #include "base/task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 input_controller_.SetInputDeviceFactory(input_device_factory_.get()); 137 input_controller_.SetInputDeviceFactory(input_device_factory_.get());
138 138
139 // Scan & monitor devices. 139 // Scan & monitor devices.
140 device_manager_->AddObserver(this); 140 device_manager_->AddObserver(this);
141 device_manager_->ScanDevices(this); 141 device_manager_->ScanDevices(this);
142 142
143 initialized_ = true; 143 initialized_ = true;
144 } 144 }
145 145
146 scoped_ptr<SystemInputInjector> EventFactoryEvdev::CreateSystemInputInjector() { 146 scoped_ptr<SystemInputInjector> EventFactoryEvdev::CreateSystemInputInjector() {
147 return make_scoped_ptr(new InputInjectorEvdev( 147 // Use forwarding dispatcher for the injector rather than dispatching
148 &modifiers_, cursor_, &keyboard_, dispatch_callback_)); 148 // directly. We cannot assume it is safe to (re-)enter ui::Event dispatch
149 // synchronously from the injection point.
150 scoped_ptr<DeviceEventDispatcherEvdev> dispatcher(
151 new ProxyDeviceEventDispatcher(base::ThreadTaskRunnerHandle::Get(),
152 weak_ptr_factory_.GetWeakPtr()));
153 return make_scoped_ptr(new InputInjectorEvdev(dispatcher.Pass(), cursor_));
149 } 154 }
150 155
151 void EventFactoryEvdev::DispatchKeyEvent(const KeyEventParams& params) { 156 void EventFactoryEvdev::DispatchKeyEvent(const KeyEventParams& params) {
152 keyboard_.OnKeyChange(params.code, params.down); 157 keyboard_.OnKeyChange(params.code, params.down);
153 } 158 }
154 159
155 void EventFactoryEvdev::DispatchMouseMoveEvent( 160 void EventFactoryEvdev::DispatchMouseMoveEvent(
156 const MouseMoveEventParams& params) { 161 const MouseMoveEventParams& params) {
157 scoped_ptr<MouseEvent> event(new MouseEvent(ui::ET_MOUSE_MOVED, 162 scoped_ptr<MouseEvent> event(new MouseEvent(ui::ET_MOUSE_MOVED,
158 params.location, params.location, 163 params.location, params.location,
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 modifiers_.GetModifierFlags(), 310 modifiers_.GetModifierFlags(),
306 /* changed_button_flags */ 0))); 311 /* changed_button_flags */ 0)));
307 } 312 }
308 } 313 }
309 314
310 int EventFactoryEvdev::NextDeviceId() { 315 int EventFactoryEvdev::NextDeviceId() {
311 return ++last_device_id_; 316 return ++last_device_id_;
312 } 317 }
313 318
314 } // namespace ui 319 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/events/ozone/evdev/input_injector_evdev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698