OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/extensions/api/usb/usb_device_resource.h" | 5 #include "chrome/browser/extensions/api/usb/usb_device_resource.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "chrome/browser/extensions/api/api_resource_event_notifier.h" | 13 #include "chrome/browser/extensions/api/api_resource_event_notifier.h" |
14 #include "chrome/browser/extensions/api/api_resource.h" | 14 #include "chrome/browser/extensions/api/api_resource.h" |
15 #include "chrome/browser/usb/usb_device.h" | 15 #include "chrome/browser/usb/usb_device.h" |
16 #include "chrome/common/extensions/api/experimental.usb.h" | 16 #include "chrome/common/extensions/api/experimental_usb.h" |
17 | 17 |
18 using extensions::api::experimental_usb::ControlTransferInfo; | 18 using extensions::api::experimental_usb::ControlTransferInfo; |
19 using extensions::api::experimental_usb::GenericTransferInfo; | 19 using extensions::api::experimental_usb::GenericTransferInfo; |
20 using std::string; | 20 using std::string; |
21 using std::vector; | 21 using std::vector; |
22 | 22 |
23 static const char* kDirectionIn = "in"; | 23 static const char* kDirectionIn = "in"; |
24 static const char* kDirectionOut = "out"; | 24 static const char* kDirectionOut = "out"; |
25 | 25 |
26 static const char* kRequestTypeStandard = "standard"; | 26 static const char* kRequestTypeStandard = "standard"; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 base::ListValue *const response_buffer = new base::ListValue(); | 190 base::ListValue *const response_buffer = new base::ListValue(); |
191 for (unsigned int i = 0; i < length; ++i) { | 191 for (unsigned int i = 0; i < length; ++i) { |
192 const uint8_t value = buffer->data()[i] & 0xFF; | 192 const uint8_t value = buffer->data()[i] & 0xFF; |
193 response_buffer->Append(base::Value::CreateIntegerValue(value)); | 193 response_buffer->Append(base::Value::CreateIntegerValue(value)); |
194 } | 194 } |
195 event_notifier()->OnTransferComplete(success, response_buffer); | 195 event_notifier()->OnTransferComplete(success, response_buffer); |
196 } | 196 } |
197 } | 197 } |
198 | 198 |
199 } // namespace extensions | 199 } // namespace extensions |
OLD | NEW |