| 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 #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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 struct ConnectParams; | 32 struct ConnectParams; |
| 33 class FileThreadHelper; | 33 class FileThreadHelper; |
| 34 | 34 |
| 35 // These functions implement the process of locating, requesting access to and | 35 // These functions implement the process of locating, requesting access to and |
| 36 // opening a device. Because this operation crosses multiple threads these | 36 // opening a device. Because this operation crosses multiple threads these |
| 37 // functions are static and the necessary parameters are passed as a single | 37 // functions are static and the necessary parameters are passed as a single |
| 38 // struct. | 38 // struct. |
| 39 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
| 40 static void OnPathOpened(scoped_ptr<ConnectParams> params, | 40 static void OnPathOpenComplete(scoped_ptr<ConnectParams> params, |
| 41 dbus::FileDescriptor fd); | 41 dbus::FileDescriptor fd); |
| 42 static void OnPathOpenError(const std::string& device_path, |
| 43 const ConnectCallback& callback, |
| 44 const std::string& error_name, |
| 45 const std::string& error_message); |
| 42 static void ValidateFdOnBlockingThread(scoped_ptr<ConnectParams> params, | 46 static void ValidateFdOnBlockingThread(scoped_ptr<ConnectParams> params, |
| 43 dbus::FileDescriptor fd); | 47 dbus::FileDescriptor fd); |
| 44 #else | 48 #else |
| 45 static void OpenOnBlockingThread(scoped_ptr<ConnectParams> params); | 49 static void OpenOnBlockingThread(scoped_ptr<ConnectParams> params); |
| 46 #endif | 50 #endif |
| 47 static void FinishOpen(scoped_ptr<ConnectParams> params); | 51 static void FinishOpen(scoped_ptr<ConnectParams> params); |
| 48 static void CreateConnection(scoped_ptr<ConnectParams> params); | 52 static void CreateConnection(scoped_ptr<ConnectParams> params); |
| 49 | 53 |
| 50 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 54 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 51 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | 55 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
| 52 | 56 |
| 53 // The helper lives on the FILE thread and holds a weak reference back to the | 57 // The helper lives on the FILE thread and holds a weak reference back to the |
| 54 // service that owns it. | 58 // service that owns it. |
| 55 FileThreadHelper* helper_; | 59 FileThreadHelper* helper_; |
| 56 base::WeakPtrFactory<HidServiceLinux> weak_factory_; | 60 base::WeakPtrFactory<HidServiceLinux> weak_factory_; |
| 57 | 61 |
| 58 DISALLOW_COPY_AND_ASSIGN(HidServiceLinux); | 62 DISALLOW_COPY_AND_ASSIGN(HidServiceLinux); |
| 59 }; | 63 }; |
| 60 | 64 |
| 61 } // namespace device | 65 } // namespace device |
| 62 | 66 |
| 63 #endif // DEVICE_HID_HID_SERVICE_LINUX_H_ | 67 #endif // DEVICE_HID_HID_SERVICE_LINUX_H_ |
| OLD | NEW |