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

Side by Side Diff: device/hid/hid_service_linux.h

Issue 161823002: Clean up HID backend and API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: linux headers Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 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 #ifndef DEVICE_HID_HID_SERVICE_LINUX_H_ 5 #ifndef DEVICE_HID_HID_SERVICE_LINUX_H_
6 #define DEVICE_HID_HID_SERVICE_LINUX_H_ 6 #define DEVICE_HID_HID_SERVICE_LINUX_H_
7 7
8 #include <libudev.h> 8 #include <libudev.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 DiscardReturnType<udev_monitor, udev_monitor_unref> > UdevMonitorDeleter; 43 DiscardReturnType<udev_monitor, udev_monitor_unref> > UdevMonitorDeleter;
44 44
45 typedef scoped_ptr<udev_device, UdevDeviceDeleter> ScopedUdevDevicePtr; 45 typedef scoped_ptr<udev_device, UdevDeviceDeleter> ScopedUdevDevicePtr;
46 typedef scoped_ptr<udev_enumerate, UdevEnumerateDeleter> ScopedUdevEnumeratePtr; 46 typedef scoped_ptr<udev_enumerate, UdevEnumerateDeleter> ScopedUdevEnumeratePtr;
47 47
48 class HidServiceLinux : public HidService, 48 class HidServiceLinux : public HidService,
49 public base::MessagePumpLibevent::Watcher { 49 public base::MessagePumpLibevent::Watcher {
50 public: 50 public:
51 HidServiceLinux(); 51 HidServiceLinux();
52 52
53 virtual scoped_refptr<HidConnection> Connect(std::string device_id) OVERRIDE; 53 virtual scoped_refptr<HidConnection> Connect(const std::string& device_id)
54 OVERRIDE;
54 55
55 // Implements base::MessagePumpLibevent::Watcher 56 // Implements base::MessagePumpLibevent::Watcher
56 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; 57 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
57 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; 58 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
58 59
59 private: 60 private:
60 virtual ~HidServiceLinux(); 61 virtual ~HidServiceLinux();
61 62
62 void Enumerate(); 63 void Enumerate();
63 void PlatformDeviceAdd(udev_device* device); 64 void PlatformAddDevice(udev_device* device);
64 void PlatformDeviceRemove(udev_device* raw_dev); 65 void PlatformRemoveDevice(udev_device* raw_dev);
65 66
66 scoped_ptr<udev, UdevDeleter> udev_; 67 scoped_ptr<udev, UdevDeleter> udev_;
67 scoped_ptr<udev_monitor, UdevMonitorDeleter> monitor_; 68 scoped_ptr<udev_monitor, UdevMonitorDeleter> monitor_;
68 int monitor_fd_; 69 int monitor_fd_;
69 base::MessagePumpLibevent::FileDescriptorWatcher monitor_watcher_; 70 base::MessagePumpLibevent::FileDescriptorWatcher monitor_watcher_;
70 71
71 DISALLOW_COPY_AND_ASSIGN(HidServiceLinux); 72 DISALLOW_COPY_AND_ASSIGN(HidServiceLinux);
72 }; 73 };
73 74
74 } // namespace device 75 } // namespace device
75 76
76 #endif // DEVICE_HID_HID_SERVICE_LINUX_H_ 77 #endif // DEVICE_HID_HID_SERVICE_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698