summaryrefslogtreecommitdiff
path: root/chromium/extensions/browser/api/usb/usb_device_resource.cc
blob: 3b8f92b8f365bce264768392a7fd33e5b1e268fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/browser/api/usb/usb_device_resource.h"

#include <string>
#include <utility>
#include <vector>

#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/lazy_instance.h"
#include "base/synchronization/lock.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/api_resource.h"
#include "extensions/common/api/usb.h"

using content::BrowserThread;

namespace extensions {

static base::LazyInstance<BrowserContextKeyedAPIFactory<
    ApiResourceManager<UsbDeviceResource>>>::DestructorAtExit g_factory =
    LAZY_INSTANCE_INITIALIZER;

// static
template <>
BrowserContextKeyedAPIFactory<ApiResourceManager<UsbDeviceResource> >*
ApiResourceManager<UsbDeviceResource>::GetFactoryInstance() {
  return g_factory.Pointer();
}

UsbDeviceResource::UsbDeviceResource(const std::string& owner_extension_id,
                                     const std::string& guid,
                                     device::mojom::UsbDevicePtr device)
    : ApiResource(owner_extension_id),
      guid_(guid),
      device_(std::move(device)) {}

UsbDeviceResource::~UsbDeviceResource() {}

bool UsbDeviceResource::IsPersistent() const {
  return false;
}

}  // namespace extensions