Finish refactoring of DomCodeToUsLayoutKeyboardCode().
[chromium-blink-merge.git] / extensions / browser / api / hid / hid_connection_resource.cc
blobd77073c355de5ba7133a8fe5d4ef36dfcfb3e639
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/hid/hid_connection_resource.h"
7 #include <string>
9 #include "base/lazy_instance.h"
10 #include "base/memory/ref_counted.h"
11 #include "device/hid/hid_connection.h"
12 #include "extensions/browser/api/api_resource_manager.h"
14 namespace extensions {
16 static base::LazyInstance<
17 BrowserContextKeyedAPIFactory<ApiResourceManager<HidConnectionResource> > >
18 g_factory = LAZY_INSTANCE_INITIALIZER;
20 // static
21 template <>
22 BrowserContextKeyedAPIFactory<ApiResourceManager<HidConnectionResource> >*
23 ApiResourceManager<HidConnectionResource>::GetFactoryInstance() {
24 return &g_factory.Get();
27 HidConnectionResource::HidConnectionResource(
28 const std::string& owner_extension_id,
29 scoped_refptr<device::HidConnection> connection)
30 : ApiResource(owner_extension_id), connection_(connection) {}
32 HidConnectionResource::~HidConnectionResource() {
33 connection_->Close();
36 bool HidConnectionResource::IsPersistent() const {
37 return false;
40 } // namespace extensions