| 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 CHROME_BROWSER_EXTENSIONS_API_HID_HID_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_HID_HID_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_HID_HID_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_HID_HID_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "chrome/browser/extensions/api/api_function.h" | 12 #include "chrome/browser/extensions/api/api_function.h" |
| 13 #include "chrome/browser/extensions/api/api_resource_manager.h" | 13 #include "chrome/browser/extensions/api/api_resource_manager.h" |
| 14 #include "chrome/browser/extensions/api/hid/hid_device_resource.h" | 14 #include "chrome/browser/extensions/api/hid/hid_device_resource.h" |
| 15 #include "chrome/browser/extensions/extension_function_histogram_value.h" | 15 #include "chrome/browser/extensions/extension_function_histogram_value.h" |
| 16 #include "chrome/common/extensions/api/hid.h" | 16 #include "chrome/common/extensions/api/hid.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 class IOBuffer; | 20 class IOBufferWithSize; |
| 21 | 21 |
| 22 } // namespace net | 22 } // namespace net |
| 23 | 23 |
| 24 namespace extensions { | 24 namespace extensions { |
| 25 | 25 |
| 26 class HidAsyncApiFunction : public AsyncApiFunction { | 26 class HidAsyncApiFunction : public AsyncApiFunction { |
| 27 public: | 27 public: |
| 28 HidAsyncApiFunction(); | 28 HidAsyncApiFunction(); |
| 29 | 29 |
| 30 virtual bool PrePrepare() OVERRIDE; | 30 virtual bool PrePrepare() OVERRIDE; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 protected: | 110 protected: |
| 111 virtual bool Prepare() OVERRIDE; | 111 virtual bool Prepare() OVERRIDE; |
| 112 virtual void AsyncWorkStart() OVERRIDE; | 112 virtual void AsyncWorkStart() OVERRIDE; |
| 113 | 113 |
| 114 private: | 114 private: |
| 115 virtual ~HidReceiveFunction(); | 115 virtual ~HidReceiveFunction(); |
| 116 | 116 |
| 117 void OnFinished(bool success, size_t bytes); | 117 void OnFinished(bool success, size_t bytes); |
| 118 | 118 |
| 119 scoped_refptr<net::IOBuffer> buffer_; | 119 scoped_refptr<net::IOBufferWithSize> buffer_; |
| 120 scoped_ptr<base::ListValue> result_; | 120 scoped_ptr<base::ListValue> result_; |
| 121 scoped_ptr<extensions::api::hid::Receive::Params> parameters_; | 121 scoped_ptr<extensions::api::hid::Receive::Params> parameters_; |
| 122 | 122 |
| 123 DISALLOW_COPY_AND_ASSIGN(HidReceiveFunction); | 123 DISALLOW_COPY_AND_ASSIGN(HidReceiveFunction); |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 class HidSendFunction : public HidAsyncApiFunction { | 126 class HidSendFunction : public HidAsyncApiFunction { |
| 127 public: | 127 public: |
| 128 DECLARE_EXTENSION_FUNCTION("hid.send", HID_SEND); | 128 DECLARE_EXTENSION_FUNCTION("hid.send", HID_SEND); |
| 129 | 129 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 153 | 153 |
| 154 protected: | 154 protected: |
| 155 virtual bool Prepare() OVERRIDE; | 155 virtual bool Prepare() OVERRIDE; |
| 156 virtual void AsyncWorkStart() OVERRIDE; | 156 virtual void AsyncWorkStart() OVERRIDE; |
| 157 | 157 |
| 158 private: | 158 private: |
| 159 virtual ~HidReceiveFeatureReportFunction(); | 159 virtual ~HidReceiveFeatureReportFunction(); |
| 160 | 160 |
| 161 void OnFinished(bool success, size_t bytes); | 161 void OnFinished(bool success, size_t bytes); |
| 162 | 162 |
| 163 scoped_refptr<net::IOBuffer> buffer_; | 163 scoped_refptr<net::IOBufferWithSize> buffer_; |
| 164 scoped_ptr<base::ListValue> result_; | 164 scoped_ptr<base::ListValue> result_; |
| 165 scoped_ptr<extensions::api::hid::ReceiveFeatureReport::Params> parameters_; | 165 scoped_ptr<extensions::api::hid::ReceiveFeatureReport::Params> parameters_; |
| 166 | 166 |
| 167 DISALLOW_COPY_AND_ASSIGN(HidReceiveFeatureReportFunction); | 167 DISALLOW_COPY_AND_ASSIGN(HidReceiveFeatureReportFunction); |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 class HidSendFeatureReportFunction : public HidAsyncApiFunction { | 170 class HidSendFeatureReportFunction : public HidAsyncApiFunction { |
| 171 public: | 171 public: |
| 172 DECLARE_EXTENSION_FUNCTION("hid.sendFeatureReport", HID_SENDFEATUREREPORT); | 172 DECLARE_EXTENSION_FUNCTION("hid.sendFeatureReport", HID_SENDFEATUREREPORT); |
| 173 | 173 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 184 | 184 |
| 185 scoped_ptr<base::ListValue> result_; | 185 scoped_ptr<base::ListValue> result_; |
| 186 scoped_ptr<extensions::api::hid::SendFeatureReport::Params> parameters_; | 186 scoped_ptr<extensions::api::hid::SendFeatureReport::Params> parameters_; |
| 187 | 187 |
| 188 DISALLOW_COPY_AND_ASSIGN(HidSendFeatureReportFunction); | 188 DISALLOW_COPY_AND_ASSIGN(HidSendFeatureReportFunction); |
| 189 }; | 189 }; |
| 190 | 190 |
| 191 } // namespace extensions | 191 } // namespace extensions |
| 192 | 192 |
| 193 #endif // CHROME_BROWSER_EXTENSIONS_API_HID_HID_API_H_ | 193 #endif // CHROME_BROWSER_EXTENSIONS_API_HID_HID_API_H_ |
| OLD | NEW |