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

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

Issue 225513005: chrome.hid : enrich device info with Top-Level collections usages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enrich device info with hid usages Created 6 years, 8 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_CONNECTION_LINUX_H_ 5 #ifndef DEVICE_HID_HID_CONNECTION_LINUX_H_
6 #define DEVICE_HID_HID_CONNECTION_LINUX_H_ 6 #define DEVICE_HID_HID_CONNECTION_LINUX_H_
7 7
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "device/hid/hid_connection.h" 10 #include "device/hid/hid_connection.h"
11 #include "device/hid/hid_device_info.h" 11 #include "device/hid/hid_device_info.h"
12 #include "device/hid/hid_service_linux.h" 12 #include "device/hid/hid_service_linux.h"
13 13
14 namespace device { 14 namespace device {
15 15
16 class HidConnectionLinux : public HidConnection, 16 class HidConnectionLinux : public HidConnection,
17 public base::MessagePumpLibevent::Watcher { 17 public base::MessagePumpLibevent::Watcher {
18 public: 18 public:
19 HidConnectionLinux(HidDeviceInfo device_info, 19 HidConnectionLinux(HidDeviceInfo device_info,
20 ScopedUdevDevicePtr udev_raw_device); 20 std::string dev_node);
21 21
22 virtual void Read(scoped_refptr<net::IOBufferWithSize> buffer, 22 virtual void Read(scoped_refptr<net::IOBufferWithSize> buffer,
23 const IOCallback& callback) OVERRIDE; 23 const IOCallback& callback) OVERRIDE;
24 virtual void Write(uint8_t report_id, 24 virtual void Write(uint8_t report_id,
25 scoped_refptr<net::IOBufferWithSize> buffer, 25 scoped_refptr<net::IOBufferWithSize> buffer,
26 const IOCallback& callback) OVERRIDE; 26 const IOCallback& callback) OVERRIDE;
27 virtual void GetFeatureReport(uint8_t report_id, 27 virtual void GetFeatureReport(uint8_t report_id,
28 scoped_refptr<net::IOBufferWithSize> buffer, 28 scoped_refptr<net::IOBufferWithSize> buffer,
29 const IOCallback& callback) OVERRIDE; 29 const IOCallback& callback) OVERRIDE;
30 virtual void SendFeatureReport(uint8_t report_id, 30 virtual void SendFeatureReport(uint8_t report_id,
31 scoped_refptr<net::IOBufferWithSize> buffer, 31 scoped_refptr<net::IOBufferWithSize> buffer,
32 const IOCallback& callback) OVERRIDE; 32 const IOCallback& callback) OVERRIDE;
33 33
34 // Implements base::MessagePumpLibevent::Watcher 34 // Implements base::MessagePumpLibevent::Watcher
35 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; 35 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
36 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; 36 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
37 37
38 private: 38 private:
39 friend class base::RefCountedThreadSafe<HidConnectionLinux>; 39 friend class base::RefCountedThreadSafe<HidConnectionLinux>;
40 virtual ~HidConnectionLinux(); 40 virtual ~HidConnectionLinux();
41 41
42 static bool FindHidrawDevNode(udev_device* parent, std::string* result);
43
44 void ProcessReadQueue(); 42 void ProcessReadQueue();
45 void Disconnect(); 43 void Disconnect();
46 44
47 base::File device_file_; 45 base::File device_file_;
48 base::MessagePumpLibevent::FileDescriptorWatcher device_file_watcher_; 46 base::MessagePumpLibevent::FileDescriptorWatcher device_file_watcher_;
49 47
50 std::queue<PendingHidReport> pending_reports_; 48 std::queue<PendingHidReport> pending_reports_;
51 std::queue<PendingHidRead> pending_reads_; 49 std::queue<PendingHidRead> pending_reads_;
52 50
53 base::ThreadChecker thread_checker_; 51 base::ThreadChecker thread_checker_;
54 52
55 DISALLOW_COPY_AND_ASSIGN(HidConnectionLinux); 53 DISALLOW_COPY_AND_ASSIGN(HidConnectionLinux);
56 }; 54 };
57 55
58 } // namespace device 56 } // namespace device
59 57
60 #endif // DEVICE_HID_HID_CONNECTION_LINUX__ 58 #endif // DEVICE_HID_HID_CONNECTION_LINUX__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698