| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/events/ozone/evdev/device_manager_evdev.h" | |
| 6 | |
| 7 #include "base/files/file_enumerator.h" | |
| 8 #include "base/files/file_path.h" | |
| 9 | |
| 10 namespace ui { | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 class DeviceManagerManual : public DeviceManagerEvdev { | |
| 15 public: | |
| 16 DeviceManagerManual() {} | |
| 17 virtual ~DeviceManagerManual() {} | |
| 18 | |
| 19 // Enumerate existing devices & start watching for device changes. | |
| 20 virtual void ScanAndStartMonitoring(const EvdevDeviceCallback& device_added, | |
| 21 const EvdevDeviceCallback& device_removed) | |
| 22 OVERRIDE { | |
| 23 base::FileEnumerator file_enum(base::FilePath("/dev/input"), | |
| 24 false, | |
| 25 base::FileEnumerator::FILES, | |
| 26 "event*[0-9]"); | |
| 27 for (base::FilePath path = file_enum.Next(); !path.empty(); | |
| 28 path = file_enum.Next()) | |
| 29 device_added.Run(path); | |
| 30 } | |
| 31 | |
| 32 virtual void Stop() OVERRIDE {} | |
| 33 }; | |
| 34 | |
| 35 } // namespace | |
| 36 | |
| 37 DeviceManagerEvdev::~DeviceManagerEvdev() {} | |
| 38 | |
| 39 scoped_ptr<DeviceManagerEvdev> CreateDeviceManagerManual() { | |
| 40 return make_scoped_ptr<DeviceManagerEvdev>(new DeviceManagerManual); | |
| 41 } | |
| 42 | |
| 43 } // namespace ui | |
| OLD | NEW |