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

Side by Side Diff: device/usb/usb_device_impl.h

Issue 1565313002: Reland of Implement basic USB device enumeration on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dependency fix added to reland. Created 4 years, 11 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 | « device/usb/usb_device_android.cc ('k') | device/usb/usb_device_impl.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_USB_USB_DEVICE_IMPL_H_ 5 #ifndef DEVICE_USB_USB_DEVICE_IMPL_H_
6 #define DEVICE_USB_USB_DEVICE_IMPL_H_ 6 #define DEVICE_USB_USB_DEVICE_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9
10 #include <string>
9 #include <utility> 11 #include <utility>
10 #include <vector> 12 #include <vector>
11 13
12 #include "base/callback.h" 14 #include "base/callback.h"
13 #include "base/macros.h" 15 #include "base/macros.h"
14 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
15 #include "build/build_config.h" 17 #include "build/build_config.h"
16 #include "device/usb/usb_descriptors.h" 18 #include "device/usb/usb_descriptors.h"
17 #include "device/usb/usb_device.h" 19 #include "device/usb/usb_device.h"
18 #include "device/usb/webusb_descriptors.h" 20 #include "device/usb/webusb_descriptors.h"
(...skipping 19 matching lines...) Expand all
38 typedef struct libusb_config_descriptor* PlatformUsbConfigDescriptor; 40 typedef struct libusb_config_descriptor* PlatformUsbConfigDescriptor;
39 typedef struct libusb_device_handle* PlatformUsbDeviceHandle; 41 typedef struct libusb_device_handle* PlatformUsbDeviceHandle;
40 42
41 class UsbDeviceImpl : public UsbDevice { 43 class UsbDeviceImpl : public UsbDevice {
42 public: 44 public:
43 // UsbDevice implementation: 45 // UsbDevice implementation:
44 #if defined(OS_CHROMEOS) 46 #if defined(OS_CHROMEOS)
45 void CheckUsbAccess(const ResultCallback& callback) override; 47 void CheckUsbAccess(const ResultCallback& callback) override;
46 #endif // OS_CHROMEOS 48 #endif // OS_CHROMEOS
47 void Open(const OpenCallback& callback) override; 49 void Open(const OpenCallback& callback) override;
48 bool Close(scoped_refptr<UsbDeviceHandle> handle) override;
49 const UsbConfigDescriptor* GetActiveConfiguration() override; 50 const UsbConfigDescriptor* GetActiveConfiguration() override;
50 51
51 // These functions are used during enumeration only. The values must not 52 // These functions are used during enumeration only. The values must not
52 // change during the object's lifetime. 53 // change during the object's lifetime.
53 void set_manufacturer_string(const base::string16& value) { 54 void set_manufacturer_string(const base::string16& value) {
54 manufacturer_string_ = value; 55 manufacturer_string_ = value;
55 } 56 }
56 void set_product_string(const base::string16& value) { 57 void set_product_string(const base::string16& value) {
57 product_string_ = value; 58 product_string_ = value;
58 } 59 }
(...skipping 21 matching lines...) Expand all
80 81
81 ~UsbDeviceImpl() override; 82 ~UsbDeviceImpl() override;
82 83
83 // Called only by UsbServiceImpl. 84 // Called only by UsbServiceImpl.
84 void set_visited(bool visited) { visited_ = visited; } 85 void set_visited(bool visited) { visited_ = visited; }
85 bool was_visited() const { return visited_; } 86 bool was_visited() const { return visited_; }
86 void OnDisconnect(); 87 void OnDisconnect();
87 void ReadAllConfigurations(); 88 void ReadAllConfigurations();
88 89
89 // Called by UsbDeviceHandleImpl. 90 // Called by UsbDeviceHandleImpl.
91 void Close(scoped_refptr<UsbDeviceHandle> handle);
90 void RefreshActiveConfiguration(); 92 void RefreshActiveConfiguration();
91 93
92 private: 94 private:
93 void GetAllConfigurations(); 95 void GetAllConfigurations();
94 #if defined(OS_CHROMEOS) 96 #if defined(OS_CHROMEOS)
95 void OnOpenRequestComplete(const OpenCallback& callback, 97 void OnOpenRequestComplete(const OpenCallback& callback,
96 dbus::FileDescriptor fd); 98 dbus::FileDescriptor fd);
97 void OpenOnBlockingThreadWithFd(dbus::FileDescriptor fd, 99 void OpenOnBlockingThreadWithFd(dbus::FileDescriptor fd,
98 const OpenCallback& callback); 100 const OpenCallback& callback);
99 #endif 101 #endif
(...skipping 23 matching lines...) Expand all
123 125
124 scoped_refptr<base::SequencedTaskRunner> task_runner_; 126 scoped_refptr<base::SequencedTaskRunner> task_runner_;
125 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 127 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
126 128
127 DISALLOW_COPY_AND_ASSIGN(UsbDeviceImpl); 129 DISALLOW_COPY_AND_ASSIGN(UsbDeviceImpl);
128 }; 130 };
129 131
130 } // namespace device 132 } // namespace device
131 133
132 #endif // DEVICE_USB_USB_DEVICE_IMPL_H_ 134 #endif // DEVICE_USB_USB_DEVICE_IMPL_H_
OLDNEW
« no previous file with comments | « device/usb/usb_device_android.cc ('k') | device/usb/usb_device_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698