Finish refactoring of DomCodeToUsLayoutKeyboardCode().
[chromium-blink-merge.git] / extensions / browser / api / usb / usb_device_resource.h
blobd44675fe8db41ee68fba28e2b9ece2959ef5f6cf
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 #ifndef EXTENSIONS_BROWSER_API_USB_USB_DEVICE_RESOURCE_H_
6 #define EXTENSIONS_BROWSER_API_USB_USB_DEVICE_RESOURCE_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/synchronization/lock.h"
13 #include "content/public/browser/browser_thread.h"
14 #include "device/usb/usb_device_handle.h"
15 #include "extensions/browser/api/api_resource.h"
16 #include "extensions/browser/api/api_resource_manager.h"
18 namespace usb_service {
19 class UsbDeviceHandle;
22 namespace extensions {
24 // A UsbDeviceResource is an ApiResource wrapper for a UsbDevice.
25 class UsbDeviceResource : public ApiResource {
26 public:
27 static const content::BrowserThread::ID kThreadId =
28 content::BrowserThread::UI;
30 UsbDeviceResource(const std::string& owner_extension_id,
31 scoped_refptr<device::UsbDeviceHandle> device);
32 ~UsbDeviceResource() override;
34 scoped_refptr<device::UsbDeviceHandle> device() { return device_; }
36 bool IsPersistent() const override;
38 private:
39 friend class ApiResourceManager<UsbDeviceResource>;
40 static const char* service_name() { return "UsbDeviceResourceManager"; }
42 scoped_refptr<device::UsbDeviceHandle> device_;
44 DISALLOW_COPY_AND_ASSIGN(UsbDeviceResource);
47 } // namespace extensions
49 #endif // EXTENSIONS_BROWSER_API_USB_USB_DEVICE_RESOURCE_H_