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

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

Issue 2291983002: chromeos: Remove dbus::FileDescriptor from PermissionBrokerClient (Closed)
Patch Set: Address comments Created 4 years, 3 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
« no previous file with comments | « chromeos/network/firewall_hole.cc ('k') | device/hid/hid_service_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #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 <memory> 8 #include <memory>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/files/scoped_file.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
13 #include "build/build_config.h" 14 #include "build/build_config.h"
14 #include "device/hid/hid_device_info.h" 15 #include "device/hid/hid_device_info.h"
15 #include "device/hid/hid_service.h" 16 #include "device/hid/hid_service.h"
16 17
17 namespace dbus {
18 class FileDescriptor;
19 }
20
21 namespace device { 18 namespace device {
22 19
23 class HidConnection; 20 class HidConnection;
24 21
25 class HidServiceLinux : public HidService { 22 class HidServiceLinux : public HidService {
26 public: 23 public:
27 HidServiceLinux(scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); 24 HidServiceLinux(scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
28 ~HidServiceLinux() override; 25 ~HidServiceLinux() override;
29 26
30 void Connect(const HidDeviceId& device_id, 27 void Connect(const HidDeviceId& device_id,
31 const ConnectCallback& callback) override; 28 const ConnectCallback& callback) override;
32 29
33 private: 30 private:
34 struct ConnectParams; 31 struct ConnectParams;
35 class FileThreadHelper; 32 class FileThreadHelper;
36 33
37 // These functions implement the process of locating, requesting access to and 34 // These functions implement the process of locating, requesting access to and
38 // opening a device. Because this operation crosses multiple threads these 35 // opening a device. Because this operation crosses multiple threads these
39 // functions are static and the necessary parameters are passed as a single 36 // functions are static and the necessary parameters are passed as a single
40 // struct. 37 // struct.
41 #if defined(OS_CHROMEOS) 38 #if defined(OS_CHROMEOS)
42 static void OnPathOpenComplete(std::unique_ptr<ConnectParams> params, 39 static void OnPathOpenComplete(std::unique_ptr<ConnectParams> params,
43 dbus::FileDescriptor fd); 40 base::ScopedFD fd);
44 static void OnPathOpenError(const std::string& device_path, 41 static void OnPathOpenError(const std::string& device_path,
45 const ConnectCallback& callback, 42 const ConnectCallback& callback,
46 const std::string& error_name, 43 const std::string& error_name,
47 const std::string& error_message); 44 const std::string& error_message);
48 static void ValidateFdOnBlockingThread(std::unique_ptr<ConnectParams> params,
49 dbus::FileDescriptor fd);
50 #else 45 #else
51 static void OpenOnBlockingThread(std::unique_ptr<ConnectParams> params); 46 static void OpenOnBlockingThread(std::unique_ptr<ConnectParams> params);
52 #endif 47 #endif
53 static void FinishOpen(std::unique_ptr<ConnectParams> params); 48 static void FinishOpen(std::unique_ptr<ConnectParams> params);
54 static void CreateConnection(std::unique_ptr<ConnectParams> params); 49 static void CreateConnection(std::unique_ptr<ConnectParams> params);
55 50
56 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 51 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
57 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; 52 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
58 53
59 // The helper lives on the FILE thread and holds a weak reference back to the 54 // The helper lives on the FILE thread and holds a weak reference back to the
60 // service that owns it. 55 // service that owns it.
61 FileThreadHelper* helper_; 56 FileThreadHelper* helper_;
62 base::WeakPtrFactory<HidServiceLinux> weak_factory_; 57 base::WeakPtrFactory<HidServiceLinux> weak_factory_;
63 58
64 DISALLOW_COPY_AND_ASSIGN(HidServiceLinux); 59 DISALLOW_COPY_AND_ASSIGN(HidServiceLinux);
65 }; 60 };
66 61
67 } // namespace device 62 } // namespace device
68 63
69 #endif // DEVICE_HID_HID_SERVICE_LINUX_H_ 64 #endif // DEVICE_HID_HID_SERVICE_LINUX_H_
OLDNEW
« no previous file with comments | « chromeos/network/firewall_hole.cc ('k') | device/hid/hid_service_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698