| 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" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 HidReceiveFunction(); | 106 HidReceiveFunction(); |
| 107 | 107 |
| 108 protected: | 108 protected: |
| 109 virtual bool Prepare() OVERRIDE; | 109 virtual bool Prepare() OVERRIDE; |
| 110 virtual void AsyncWorkStart() OVERRIDE; | 110 virtual void AsyncWorkStart() OVERRIDE; |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 virtual ~HidReceiveFunction(); | 113 virtual ~HidReceiveFunction(); |
| 114 | 114 |
| 115 void OnFinished(bool success, size_t bytes); | 115 void OnFinished(bool success, |
| 116 scoped_refptr<net::IOBuffer> buffer, |
| 117 size_t size); |
| 116 | 118 |
| 117 bool has_report_id_; | |
| 118 scoped_refptr<net::IOBufferWithSize> buffer_; | |
| 119 scoped_ptr<core_api::hid::Receive::Params> parameters_; | 119 scoped_ptr<core_api::hid::Receive::Params> parameters_; |
| 120 | 120 |
| 121 DISALLOW_COPY_AND_ASSIGN(HidReceiveFunction); | 121 DISALLOW_COPY_AND_ASSIGN(HidReceiveFunction); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 class HidSendFunction : public HidAsyncApiFunction { | 124 class HidSendFunction : public HidAsyncApiFunction { |
| 125 public: | 125 public: |
| 126 DECLARE_EXTENSION_FUNCTION("hid.send", HID_SEND); | 126 DECLARE_EXTENSION_FUNCTION("hid.send", HID_SEND); |
| 127 | 127 |
| 128 HidSendFunction(); | 128 HidSendFunction(); |
| 129 | 129 |
| 130 protected: | 130 protected: |
| 131 virtual bool Prepare() OVERRIDE; | 131 virtual bool Prepare() OVERRIDE; |
| 132 virtual void AsyncWorkStart() OVERRIDE; | 132 virtual void AsyncWorkStart() OVERRIDE; |
| 133 | 133 |
| 134 private: | 134 private: |
| 135 virtual ~HidSendFunction(); | 135 virtual ~HidSendFunction(); |
| 136 | 136 |
| 137 void OnFinished(bool success, size_t bytes); | 137 void OnFinished(bool success); |
| 138 | 138 |
| 139 scoped_ptr<core_api::hid::Send::Params> parameters_; | 139 scoped_ptr<core_api::hid::Send::Params> parameters_; |
| 140 | 140 |
| 141 DISALLOW_COPY_AND_ASSIGN(HidSendFunction); | 141 DISALLOW_COPY_AND_ASSIGN(HidSendFunction); |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 class HidReceiveFeatureReportFunction : public HidAsyncApiFunction { | 144 class HidReceiveFeatureReportFunction : public HidAsyncApiFunction { |
| 145 public: | 145 public: |
| 146 DECLARE_EXTENSION_FUNCTION("hid.receiveFeatureReport", | 146 DECLARE_EXTENSION_FUNCTION("hid.receiveFeatureReport", |
| 147 HID_RECEIVEFEATUREREPORT); | 147 HID_RECEIVEFEATUREREPORT); |
| 148 | 148 |
| 149 HidReceiveFeatureReportFunction(); | 149 HidReceiveFeatureReportFunction(); |
| 150 | 150 |
| 151 protected: | 151 protected: |
| 152 virtual bool Prepare() OVERRIDE; | 152 virtual bool Prepare() OVERRIDE; |
| 153 virtual void AsyncWorkStart() OVERRIDE; | 153 virtual void AsyncWorkStart() OVERRIDE; |
| 154 | 154 |
| 155 private: | 155 private: |
| 156 virtual ~HidReceiveFeatureReportFunction(); | 156 virtual ~HidReceiveFeatureReportFunction(); |
| 157 | 157 |
| 158 void OnFinished(bool success, size_t bytes); | 158 void OnFinished(bool success, |
| 159 scoped_refptr<net::IOBuffer> buffer, |
| 160 size_t size); |
| 159 | 161 |
| 160 scoped_refptr<net::IOBufferWithSize> buffer_; | |
| 161 scoped_ptr<core_api::hid::ReceiveFeatureReport::Params> parameters_; | 162 scoped_ptr<core_api::hid::ReceiveFeatureReport::Params> parameters_; |
| 162 | 163 |
| 163 DISALLOW_COPY_AND_ASSIGN(HidReceiveFeatureReportFunction); | 164 DISALLOW_COPY_AND_ASSIGN(HidReceiveFeatureReportFunction); |
| 164 }; | 165 }; |
| 165 | 166 |
| 166 class HidSendFeatureReportFunction : public HidAsyncApiFunction { | 167 class HidSendFeatureReportFunction : public HidAsyncApiFunction { |
| 167 public: | 168 public: |
| 168 DECLARE_EXTENSION_FUNCTION("hid.sendFeatureReport", HID_SENDFEATUREREPORT); | 169 DECLARE_EXTENSION_FUNCTION("hid.sendFeatureReport", HID_SENDFEATUREREPORT); |
| 169 | 170 |
| 170 HidSendFeatureReportFunction(); | 171 HidSendFeatureReportFunction(); |
| 171 | 172 |
| 172 protected: | 173 protected: |
| 173 virtual bool Prepare() OVERRIDE; | 174 virtual bool Prepare() OVERRIDE; |
| 174 virtual void AsyncWorkStart() OVERRIDE; | 175 virtual void AsyncWorkStart() OVERRIDE; |
| 175 | 176 |
| 176 private: | 177 private: |
| 177 virtual ~HidSendFeatureReportFunction(); | 178 virtual ~HidSendFeatureReportFunction(); |
| 178 | 179 |
| 179 void OnFinished(bool success, size_t bytes); | 180 void OnFinished(bool success); |
| 180 | 181 |
| 181 scoped_ptr<core_api::hid::SendFeatureReport::Params> parameters_; | 182 scoped_ptr<core_api::hid::SendFeatureReport::Params> parameters_; |
| 182 | 183 |
| 183 DISALLOW_COPY_AND_ASSIGN(HidSendFeatureReportFunction); | 184 DISALLOW_COPY_AND_ASSIGN(HidSendFeatureReportFunction); |
| 184 }; | 185 }; |
| 185 | 186 |
| 186 } // namespace extensions | 187 } // namespace extensions |
| 187 | 188 |
| 188 #endif // EXTENSIONS_BROWSER_API_HID_HID_API_H_ | 189 #endif // EXTENSIONS_BROWSER_API_HID_HID_API_H_ |
| OLD | NEW |