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 "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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 | 149 |
150 void EventFactoryEvdev::PostUiEvent(scoped_ptr<Event> event) { | 150 void EventFactoryEvdev::PostUiEvent(scoped_ptr<Event> event) { |
151 base::ThreadTaskRunnerHandle::Get()->PostTask( | 151 base::ThreadTaskRunnerHandle::Get()->PostTask( |
152 FROM_HERE, | 152 FROM_HERE, |
153 base::Bind(&EventFactoryEvdev::DispatchUiEventTask, | 153 base::Bind(&EventFactoryEvdev::DispatchUiEventTask, |
154 weak_ptr_factory_.GetWeakPtr(), | 154 weak_ptr_factory_.GetWeakPtr(), |
155 base::Passed(&event))); | 155 base::Passed(&event))); |
156 } | 156 } |
157 | 157 |
| 158 void EventFactoryEvdev::DispatchKeyboardDevicesUpdated( |
| 159 const std::vector<KeyboardDevice>& devices) { |
| 160 DeviceHotplugEventObserver* observer = DeviceDataManager::GetInstance(); |
| 161 observer->OnKeyboardDevicesUpdated(devices); |
| 162 } |
| 163 |
| 164 void EventFactoryEvdev::DispatchTouchscreenDevicesUpdated( |
| 165 const std::vector<TouchscreenDevice>& devices) { |
| 166 DeviceHotplugEventObserver* observer = DeviceDataManager::GetInstance(); |
| 167 observer->OnTouchscreenDevicesUpdated(devices); |
| 168 } |
| 169 |
| 170 void EventFactoryEvdev::DispatchMouseDevicesUpdated( |
| 171 const std::vector<InputDevice>& devices) { |
| 172 // There's no list of mice in DeviceDataManager. |
| 173 input_controller_.set_has_mouse(devices.size() != 0); |
| 174 } |
| 175 |
| 176 void EventFactoryEvdev::DispatchTouchpadDevicesUpdated( |
| 177 const std::vector<InputDevice>& devices) { |
| 178 // There's no list of touchpads in DeviceDataManager. |
| 179 input_controller_.set_has_touchpad(devices.size() != 0); |
| 180 } |
| 181 |
158 void EventFactoryEvdev::DispatchUiEventTask(scoped_ptr<Event> event) { | 182 void EventFactoryEvdev::DispatchUiEventTask(scoped_ptr<Event> event) { |
159 DispatchEvent(event.get()); | 183 DispatchEvent(event.get()); |
160 } | 184 } |
161 | 185 |
162 void EventFactoryEvdev::OnDeviceEvent(const DeviceEvent& event) { | 186 void EventFactoryEvdev::OnDeviceEvent(const DeviceEvent& event) { |
163 if (event.device_type() != DeviceEvent::INPUT) | 187 if (event.device_type() != DeviceEvent::INPUT) |
164 return; | 188 return; |
165 | 189 |
166 switch (event.action_type()) { | 190 switch (event.action_type()) { |
167 case DeviceEvent::ADD: | 191 case DeviceEvent::ADD: |
(...skipping 25 matching lines...) Expand all Loading... |
193 modifiers_.GetModifierFlags(), | 217 modifiers_.GetModifierFlags(), |
194 /* changed_button_flags */ 0))); | 218 /* changed_button_flags */ 0))); |
195 } | 219 } |
196 } | 220 } |
197 | 221 |
198 int EventFactoryEvdev::NextDeviceId() { | 222 int EventFactoryEvdev::NextDeviceId() { |
199 return ++last_device_id_; | 223 return ++last_device_id_; |
200 } | 224 } |
201 | 225 |
202 } // namespace ui | 226 } // namespace ui |
OLD | NEW |