| 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" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 146 } |
| 147 | 147 |
| 148 NOTREACHED(); | 148 NOTREACHED(); |
| 149 return ""; | 149 return ""; |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace | 152 } // namespace |
| 153 | 153 |
| 154 namespace extensions { | 154 namespace extensions { |
| 155 | 155 |
| 156 UsbDeviceResource::UsbDeviceResource(ApiResourceEventNotifier* notifier, | 156 UsbDeviceResource::UsbDeviceResource(const std::string& owner_extension_id, |
| 157 ApiResourceEventNotifier* notifier, |
| 157 UsbDevice* device) | 158 UsbDevice* device) |
| 158 : ApiResource(notifier), device_(device) {} | 159 : ApiResource(owner_extension_id, notifier), device_(device) {} |
| 159 | 160 |
| 160 UsbDeviceResource::~UsbDeviceResource() { | 161 UsbDeviceResource::~UsbDeviceResource() { |
| 161 Close(); | 162 Close(); |
| 162 } | 163 } |
| 163 | 164 |
| 164 void UsbDeviceResource::Close() { | 165 void UsbDeviceResource::Close() { |
| 165 device_->Close(); | 166 device_->Close(); |
| 166 } | 167 } |
| 167 | 168 |
| 168 void UsbDeviceResource::ControlTransfer(const ControlTransferInfo& transfer) { | 169 void UsbDeviceResource::ControlTransfer(const ControlTransferInfo& transfer) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 UsbTransferStatus status) { | 245 UsbTransferStatus status) { |
| 245 if (buffer) { | 246 if (buffer) { |
| 246 base::BinaryValue* const response_buffer = | 247 base::BinaryValue* const response_buffer = |
| 247 base::BinaryValue::CreateWithCopiedBuffer(buffer->data(), length); | 248 base::BinaryValue::CreateWithCopiedBuffer(buffer->data(), length); |
| 248 event_notifier()->OnTransferComplete(status, | 249 event_notifier()->OnTransferComplete(status, |
| 249 ConvertTransferStatusToErrorString(status), response_buffer); | 250 ConvertTransferStatusToErrorString(status), response_buffer); |
| 250 } | 251 } |
| 251 } | 252 } |
| 252 | 253 |
| 253 } // namespace extensions | 254 } // namespace extensions |
| OLD | NEW |