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/device/udev/device_manager_udev.h" | 5 #include "ui/events/ozone/device/udev/device_manager_udev.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 LOG(ERROR) << "Failed to start receiving events from udev"; | 75 LOG(ERROR) << "Failed to start receiving events from udev"; |
76 } else { | 76 } else { |
77 LOG(ERROR) << "Failed to create udev monitor"; | 77 LOG(ERROR) << "Failed to create udev monitor"; |
78 } | 78 } |
79 | 79 |
80 return device::ScopedUdevMonitorPtr(monitor); | 80 return device::ScopedUdevMonitorPtr(monitor); |
81 } | 81 } |
82 | 82 |
83 } // namespace | 83 } // namespace |
84 | 84 |
85 DeviceManagerUdev::DeviceManagerUdev() : udev_(UdevCreate()) { | 85 DeviceManagerUdev::DeviceManagerUdev() |
86 } | 86 : udev_(UdevCreate()), controller_(FROM_HERE) {} |
87 | 87 |
88 DeviceManagerUdev::~DeviceManagerUdev() { | 88 DeviceManagerUdev::~DeviceManagerUdev() { |
89 } | 89 } |
90 | 90 |
91 void DeviceManagerUdev::CreateMonitor() { | 91 void DeviceManagerUdev::CreateMonitor() { |
92 if (monitor_) | 92 if (monitor_) |
93 return; | 93 return; |
94 monitor_ = UdevCreateMonitor(udev_.get()); | 94 monitor_ = UdevCreateMonitor(udev_.get()); |
95 if (monitor_) { | 95 if (monitor_) { |
96 int fd = device::udev_monitor_get_fd(monitor_.get()); | 96 int fd = device::udev_monitor_get_fd(monitor_.get()); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 else if (!strcmp(action, "change")) | 185 else if (!strcmp(action, "change")) |
186 action_type = DeviceEvent::CHANGE; | 186 action_type = DeviceEvent::CHANGE; |
187 else | 187 else |
188 return nullptr; | 188 return nullptr; |
189 | 189 |
190 return base::MakeUnique<DeviceEvent>(device_type, action_type, | 190 return base::MakeUnique<DeviceEvent>(device_type, action_type, |
191 base::FilePath(path)); | 191 base::FilePath(path)); |
192 } | 192 } |
193 | 193 |
194 } // namespace ui | 194 } // namespace ui |
OLD | NEW |