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

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

Issue 868043003: [PATCH 8/11] ozone: evdev: Plumb device changes to EventFactoryEvdev (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates for events_unittests Created 5 years, 11 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
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 153
154 void EventFactoryEvdev::PostUiEvent(scoped_ptr<Event> event) { 154 void EventFactoryEvdev::PostUiEvent(scoped_ptr<Event> event) {
155 base::ThreadTaskRunnerHandle::Get()->PostTask( 155 base::ThreadTaskRunnerHandle::Get()->PostTask(
156 FROM_HERE, 156 FROM_HERE,
157 base::Bind(&EventFactoryEvdev::DispatchUiEventTask, 157 base::Bind(&EventFactoryEvdev::DispatchUiEventTask,
158 weak_ptr_factory_.GetWeakPtr(), 158 weak_ptr_factory_.GetWeakPtr(),
159 base::Passed(&event))); 159 base::Passed(&event)));
160 } 160 }
161 161
162 void EventFactoryEvdev::DispatchKeyboardDevicesUpdated(
163 const std::vector<KeyboardDevice>& devices) {
164 DeviceHotplugEventObserver* observer = DeviceDataManager::GetInstance();
165 observer->OnKeyboardDevicesUpdated(devices);
166 }
167
168 void EventFactoryEvdev::DispatchTouchscreenDevicesUpdated(
169 const std::vector<TouchscreenDevice>& devices) {
170 DeviceHotplugEventObserver* observer = DeviceDataManager::GetInstance();
171 observer->OnTouchscreenDevicesUpdated(devices);
172 }
173
174 void EventFactoryEvdev::DispatchMouseDevicesUpdated(
175 const std::vector<InputDevice>& devices) {
176 // There's no list of mice in DeviceDataManager.
177 input_controller_.SetHasMouse(devices.size() != 0);
178 }
179
180 void EventFactoryEvdev::DispatchTouchpadDevicesUpdated(
181 const std::vector<InputDevice>& devices) {
182 // There's no list of touchpads in DeviceDataManager.
183 input_controller_.SetHasTouchpad(devices.size() != 0);
184 }
185
162 void EventFactoryEvdev::DispatchUiEventTask(scoped_ptr<Event> event) { 186 void EventFactoryEvdev::DispatchUiEventTask(scoped_ptr<Event> event) {
163 DispatchEvent(event.get()); 187 DispatchEvent(event.get());
164 } 188 }
165 189
166 void EventFactoryEvdev::OnDeviceEvent(const DeviceEvent& event) { 190 void EventFactoryEvdev::OnDeviceEvent(const DeviceEvent& event) {
167 if (event.device_type() != DeviceEvent::INPUT) 191 if (event.device_type() != DeviceEvent::INPUT)
168 return; 192 return;
169 193
170 switch (event.action_type()) { 194 switch (event.action_type()) {
171 case DeviceEvent::ADD: 195 case DeviceEvent::ADD:
(...skipping 25 matching lines...) Expand all
197 modifiers_.GetModifierFlags(), 221 modifiers_.GetModifierFlags(),
198 /* changed_button_flags */ 0))); 222 /* changed_button_flags */ 0)));
199 } 223 }
200 } 224 }
201 225
202 int EventFactoryEvdev::NextDeviceId() { 226 int EventFactoryEvdev::NextDeviceId() {
203 return ++last_device_id_; 227 return ++last_device_id_;
204 } 228 }
205 229
206 } // namespace ui 230 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698