| 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/libgestures_glue/event_reader_libevdev_cros.h" | 5 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <libevdev/libevdev.h> | 8 #include <libevdev/libevdev.h> |
| 9 #include <linux/input.h> | 9 #include <linux/input.h> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 std::string FormatLog(const char* fmt, va_list args) { | 21 std::string FormatLog(const char* fmt, va_list args) { |
| 22 std::string msg = base::StringPrintV(fmt, args); | 22 std::string msg = base::StringPrintV(fmt, args); |
| 23 if (!msg.empty() && msg[msg.size() - 1] == '\n') | 23 if (!msg.empty() && msg[msg.size() - 1] == '\n') |
| 24 msg.erase(msg.end() - 1, msg.end()); | 24 msg.erase(msg.end() - 1, msg.end()); |
| 25 return msg; | 25 return msg; |
| 26 } | 26 } |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 EventReaderLibevdevCros::EventReaderLibevdevCros(int fd, | 30 EventReaderLibevdevCros::EventReaderLibevdevCros( |
| 31 const base::FilePath& path, | 31 int fd, |
| 32 int id, | 32 const base::FilePath& path, |
| 33 const EventDeviceInfo& devinfo, | 33 int id, |
| 34 scoped_ptr<Delegate> delegate) | 34 const EventDeviceInfo& devinfo, |
| 35 std::unique_ptr<Delegate> delegate) |
| 35 : EventConverterEvdev(fd, | 36 : EventConverterEvdev(fd, |
| 36 path, | 37 path, |
| 37 id, | 38 id, |
| 38 devinfo.device_type(), | 39 devinfo.device_type(), |
| 39 devinfo.name(), | 40 devinfo.name(), |
| 40 devinfo.vendor_id(), | 41 devinfo.vendor_id(), |
| 41 devinfo.product_id()), | 42 devinfo.product_id()), |
| 42 has_keyboard_(devinfo.HasKeyboard()), | 43 has_keyboard_(devinfo.HasKeyboard()), |
| 43 has_mouse_(devinfo.HasMouse()), | 44 has_mouse_(devinfo.HasMouse()), |
| 44 has_touchpad_(devinfo.HasTouchpad()), | 45 has_touchpad_(devinfo.HasTouchpad()), |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (level >= LOGLEVEL_ERROR) | 127 if (level >= LOGLEVEL_ERROR) |
| 127 LOG(ERROR) << "libevdev: " << FormatLog(fmt, args); | 128 LOG(ERROR) << "libevdev: " << FormatLog(fmt, args); |
| 128 else if (level >= LOGLEVEL_WARNING) | 129 else if (level >= LOGLEVEL_WARNING) |
| 129 LOG(WARNING) << "libevdev: " << FormatLog(fmt, args); | 130 LOG(WARNING) << "libevdev: " << FormatLog(fmt, args); |
| 130 else | 131 else |
| 131 VLOG(3) << "libevdev: " << FormatLog(fmt, args); | 132 VLOG(3) << "libevdev: " << FormatLog(fmt, args); |
| 132 va_end(args); | 133 va_end(args); |
| 133 } | 134 } |
| 134 | 135 |
| 135 } // namespace ui | 136 } // namespace ui |
| OLD | NEW |