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 EXTENSIONS_BROWSER_API_HID_HID_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_HID_HID_API_H_ |
6 #define EXTENSIONS_BROWSER_API_HID_HID_API_H_ | 6 #define EXTENSIONS_BROWSER_API_HID_HID_API_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "extensions/browser/api/api_resource_manager.h" | 12 #include "extensions/browser/api/api_resource_manager.h" |
13 #include "extensions/browser/api/async_api_function.h" | 13 #include "extensions/browser/api/async_api_function.h" |
14 #include "extensions/browser/api/hid/hid_connection_resource.h" | 14 #include "extensions/browser/api/hid/hid_connection_resource.h" |
15 #include "extensions/browser/api/hid/hid_device_manager.h" | 15 #include "extensions/browser/api/hid/hid_device_manager.h" |
16 #include "extensions/common/api/hid.h" | 16 #include "extensions/common/api/hid.h" |
17 | 17 |
| 18 namespace device { |
| 19 class HidService; |
| 20 } // namespace device |
| 21 |
18 namespace net { | 22 namespace net { |
19 class IOBuffer; | 23 class IOBuffer; |
20 } // namespace net | 24 } // namespace net |
21 | 25 |
22 namespace extensions { | 26 namespace extensions { |
23 | 27 |
24 class HidAsyncApiFunction : public AsyncApiFunction { | 28 class HidAsyncApiFunction : public AsyncApiFunction { |
25 public: | 29 public: |
26 HidAsyncApiFunction(); | 30 HidAsyncApiFunction(); |
27 | 31 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 71 |
68 HidConnectFunction(); | 72 HidConnectFunction(); |
69 | 73 |
70 protected: | 74 protected: |
71 virtual bool Prepare() override; | 75 virtual bool Prepare() override; |
72 virtual void AsyncWorkStart() override; | 76 virtual void AsyncWorkStart() override; |
73 | 77 |
74 private: | 78 private: |
75 virtual ~HidConnectFunction(); | 79 virtual ~HidConnectFunction(); |
76 | 80 |
| 81 void OnRequestAccessComplete(bool success); |
| 82 |
77 scoped_ptr<core_api::hid::Connect::Params> parameters_; | 83 scoped_ptr<core_api::hid::Connect::Params> parameters_; |
| 84 device::HidDeviceInfo device_info_; |
| 85 device::HidService* hid_service_; |
78 | 86 |
79 DISALLOW_COPY_AND_ASSIGN(HidConnectFunction); | 87 DISALLOW_COPY_AND_ASSIGN(HidConnectFunction); |
80 }; | 88 }; |
81 | 89 |
82 class HidDisconnectFunction : public HidAsyncApiFunction { | 90 class HidDisconnectFunction : public HidAsyncApiFunction { |
83 public: | 91 public: |
84 DECLARE_EXTENSION_FUNCTION("hid.disconnect", HID_DISCONNECT); | 92 DECLARE_EXTENSION_FUNCTION("hid.disconnect", HID_DISCONNECT); |
85 | 93 |
86 HidDisconnectFunction(); | 94 HidDisconnectFunction(); |
87 | 95 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 void OnFinished(bool success); | 186 void OnFinished(bool success); |
179 | 187 |
180 scoped_ptr<core_api::hid::SendFeatureReport::Params> parameters_; | 188 scoped_ptr<core_api::hid::SendFeatureReport::Params> parameters_; |
181 | 189 |
182 DISALLOW_COPY_AND_ASSIGN(HidSendFeatureReportFunction); | 190 DISALLOW_COPY_AND_ASSIGN(HidSendFeatureReportFunction); |
183 }; | 191 }; |
184 | 192 |
185 } // namespace extensions | 193 } // namespace extensions |
186 | 194 |
187 #endif // EXTENSIONS_BROWSER_API_HID_HID_API_H_ | 195 #endif // EXTENSIONS_BROWSER_API_HID_HID_API_H_ |
OLD | NEW |