| 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.h" | 13 #include "chrome/browser/extensions/api/api_resource.h" |
| 14 #include "chrome/browser/usb/usb_device.h" | 14 #include "chrome/browser/usb/usb_device_handle.h" |
| 15 #include "chrome/common/extensions/api/usb.h" | 15 #include "chrome/common/extensions/api/usb.h" |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 | 18 |
| 19 namespace { |
| 20 |
| 21 void EmptyCallback() { } |
| 22 |
| 23 } // namepsace |
| 24 |
| 19 UsbDeviceResource::UsbDeviceResource(const std::string& owner_extension_id, | 25 UsbDeviceResource::UsbDeviceResource(const std::string& owner_extension_id, |
| 20 scoped_refptr<UsbDevice> device) | 26 scoped_refptr<UsbDeviceHandle> device) |
| 21 : ApiResource(owner_extension_id), device_(device) {} | 27 : ApiResource(owner_extension_id), device_(device) {} |
| 22 | 28 |
| 23 UsbDeviceResource::~UsbDeviceResource() {} | 29 UsbDeviceResource::~UsbDeviceResource() { |
| 30 device_->Close(base::Bind(&EmptyCallback)); |
| 31 } |
| 24 | 32 |
| 25 } // namespace extensions | 33 } // namespace extensions |
| OLD | NEW |