summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection.cc
blob: c6265f5a2c447e5553b59287119c31e64cd25cd9 (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
// Copyright 2015 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 "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_connection.h"

#include "base/lazy_instance.h"
#include "components/proximity_auth/connection.h"

namespace extensions {

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

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

EasyUnlockPrivateConnection::EasyUnlockPrivateConnection(
    bool persistent,
    const std::string& owner_extension_id,
    std::unique_ptr<proximity_auth::Connection> connection)
    : ApiResource(owner_extension_id),
      persistent_(persistent),
      connection_(connection.release()) {}

EasyUnlockPrivateConnection::~EasyUnlockPrivateConnection() {}

proximity_auth::Connection* EasyUnlockPrivateConnection::GetConnection() const {
  return connection_.get();
}

bool EasyUnlockPrivateConnection::IsPersistent() const {
  return persistent_;
}

}  // namespace extensions