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
3 // found in the LICENSE file.
5 #include "extensions/browser/api/usb/usb_device_resource.h"
10 #include "base/bind.h"
11 #include "base/bind_helpers.h"
12 #include "base/lazy_instance.h"
13 #include "base/synchronization/lock.h"
14 #include "content/public/browser/browser_thread.h"
15 #include "device/usb/usb_device_handle.h"
16 #include "extensions/browser/api/api_resource.h"
17 #include "extensions/common/api/usb.h"
19 using content::BrowserThread
;
20 using device::UsbDeviceHandle
;
22 namespace extensions
{
24 static base::LazyInstance
<
25 BrowserContextKeyedAPIFactory
<ApiResourceManager
<UsbDeviceResource
> > >
26 g_factory
= LAZY_INSTANCE_INITIALIZER
;
30 BrowserContextKeyedAPIFactory
<ApiResourceManager
<UsbDeviceResource
> >*
31 ApiResourceManager
<UsbDeviceResource
>::GetFactoryInstance() {
32 return g_factory
.Pointer();
35 UsbDeviceResource::UsbDeviceResource(const std::string
& owner_extension_id
,
36 scoped_refptr
<UsbDeviceHandle
> device
)
37 : ApiResource(owner_extension_id
), device_(device
) {
40 UsbDeviceResource::~UsbDeviceResource() {
44 bool UsbDeviceResource::IsPersistent() const {
48 } // namespace extensions