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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_USB_USB_DEVICE_RESOURCE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_USB_USB_DEVICE_RESOURCE_H_
11 #include "base/basictypes.h"
12 #include "base/memory/linked_ptr.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/synchronization/lock.h"
15 #include "chrome/browser/extensions/api/api_resource.h"
16 #include "chrome/browser/extensions/api/api_resource_manager.h"
17 #include "chrome/browser/usb/usb_device_handle.h"
18 #include "chrome/common/extensions/api/usb.h"
19 #include "content/public/browser/browser_thread.h"
21 class UsbDeviceHandle;
27 namespace extensions {
29 // A UsbDeviceResource is an ApiResource wrapper for a UsbDevice.
30 class UsbDeviceResource : public ApiResource {
32 UsbDeviceResource(const std::string& owner_extension_id,
33 scoped_refptr<UsbDeviceHandle> device);
34 virtual ~UsbDeviceResource();
36 scoped_refptr<UsbDeviceHandle> device() {
40 static const content::BrowserThread::ID kThreadId =
41 content::BrowserThread::FILE;
44 friend class ApiResourceManager<UsbDeviceResource>;
45 static const char* service_name() {
46 return "UsbDeviceResourceManager";
49 scoped_refptr<UsbDeviceHandle> device_;
51 DISALLOW_COPY_AND_ASSIGN(UsbDeviceResource);
54 } // namespace extensions
56 #endif // CHROME_BROWSER_EXTENSIONS_API_USB_USB_DEVICE_RESOURCE_H_