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_TEST_USB_TEST_GADGET_H_ | 5 #ifndef DEVICE_TEST_USB_TEST_GADGET_H_ |
6 #define DEVICE_TEST_USB_TEST_GADGET_H_ | 6 #define DEVICE_TEST_USB_TEST_GADGET_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 | 13 |
14 namespace base { | 14 namespace base { |
15 class SingleThreadTaskRunner; | 15 class SingleThreadTaskRunner; |
16 } | 16 } |
17 | 17 |
18 namespace device { | 18 namespace device { |
19 | 19 |
20 class UsbDevice; | 20 class UsbDevice; |
21 | 21 |
22 class UsbTestGadget { | 22 class UsbTestGadget { |
23 public: | 23 public: |
24 enum Type { | 24 enum Type { |
25 DEFAULT = 0, | 25 DEFAULT = 0, |
26 KEYBOARD, | 26 KEYBOARD, |
27 MOUSE, | 27 MOUSE, |
28 HID_ECHO, | 28 HID_ECHO, |
29 ECHO, | 29 ECHO, |
30 }; | 30 }; |
31 | 31 |
32 virtual ~UsbTestGadget() {} | 32 virtual ~UsbTestGadget() {} |
33 | 33 |
34 static bool IsTestEnabled(); | 34 static bool IsTestEnabled(); |
35 static scoped_ptr<UsbTestGadget> Claim( | 35 static std::unique_ptr<UsbTestGadget> Claim( |
36 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); | 36 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); |
37 | 37 |
38 virtual bool Unclaim() = 0; | 38 virtual bool Unclaim() = 0; |
39 virtual bool Disconnect() = 0; | 39 virtual bool Disconnect() = 0; |
40 virtual bool Reconnect() = 0; | 40 virtual bool Reconnect() = 0; |
41 virtual bool SetType(Type type) = 0; | 41 virtual bool SetType(Type type) = 0; |
42 | 42 |
43 virtual UsbDevice* GetDevice() const = 0; | 43 virtual UsbDevice* GetDevice() const = 0; |
44 | 44 |
45 protected: | 45 protected: |
46 UsbTestGadget() {} | 46 UsbTestGadget() {} |
47 | 47 |
48 private: | 48 private: |
49 DISALLOW_COPY_AND_ASSIGN(UsbTestGadget); | 49 DISALLOW_COPY_AND_ASSIGN(UsbTestGadget); |
50 }; | 50 }; |
51 | 51 |
52 } // namespace device | 52 } // namespace device |
53 | 53 |
54 #endif // DEVICE_TEST_USB_TEST_GADGET_H_ | 54 #endif // DEVICE_TEST_USB_TEST_GADGET_H_ |
OLD | NEW |