OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_USB_MOJO_DEVICE_IMPL_H_ | 5 #ifndef DEVICE_USB_MOJO_DEVICE_IMPL_H_ |
6 #define DEVICE_USB_MOJO_DEVICE_IMPL_H_ | 6 #define DEVICE_USB_MOJO_DEVICE_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 private: | 39 private: |
40 // Closes the device if it's open. This will always set |device_handle_| to | 40 // Closes the device if it's open. This will always set |device_handle_| to |
41 // null. | 41 // null. |
42 void CloseHandle(); | 42 void CloseHandle(); |
43 | 43 |
44 // Checks interface permissions for control transfers. | 44 // Checks interface permissions for control transfers. |
45 bool HasControlTransferPermission(ControlTransferRecipient recipient, | 45 bool HasControlTransferPermission(ControlTransferRecipient recipient, |
46 uint16_t index); | 46 uint16_t index); |
47 | 47 |
48 // Handles completion of an open request. | 48 // Handles completion of an open request. |
49 void OnOpen(const OpenCallback& callback, | 49 static void OnOpen(base::WeakPtr<DeviceImpl> device, |
50 scoped_refptr<device::UsbDeviceHandle> handle); | 50 const OpenCallback& callback, |
| 51 scoped_refptr<device::UsbDeviceHandle> handle); |
51 void OnPermissionGrantedForOpen(const OpenCallback& callback, bool granted); | 52 void OnPermissionGrantedForOpen(const OpenCallback& callback, bool granted); |
52 | 53 |
53 // Device implementation: | 54 // Device implementation: |
54 void GetDeviceInfo(const GetDeviceInfoCallback& callback) override; | 55 void GetDeviceInfo(const GetDeviceInfoCallback& callback) override; |
55 void Open(const OpenCallback& callback) override; | 56 void Open(const OpenCallback& callback) override; |
56 void Close(const CloseCallback& callback) override; | 57 void Close(const CloseCallback& callback) override; |
57 void SetConfiguration(uint8_t value, | 58 void SetConfiguration(uint8_t value, |
58 const SetConfigurationCallback& callback) override; | 59 const SetConfigurationCallback& callback) override; |
59 void ClaimInterface(uint8_t interface_number, | 60 void ClaimInterface(uint8_t interface_number, |
60 const ClaimInterfaceCallback& callback) override; | 61 const ClaimInterfaceCallback& callback) override; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 mojo::Binding<Device> binding_; | 110 mojo::Binding<Device> binding_; |
110 base::WeakPtrFactory<DeviceImpl> weak_factory_; | 111 base::WeakPtrFactory<DeviceImpl> weak_factory_; |
111 | 112 |
112 DISALLOW_COPY_AND_ASSIGN(DeviceImpl); | 113 DISALLOW_COPY_AND_ASSIGN(DeviceImpl); |
113 }; | 114 }; |
114 | 115 |
115 } // namespace usb | 116 } // namespace usb |
116 } // namespace device | 117 } // namespace device |
117 | 118 |
118 #endif // DEVICE_USB_MOJO_DEVICE_IMPL_H_ | 119 #endif // DEVICE_USB_MOJO_DEVICE_IMPL_H_ |
OLD | NEW |