| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_
connection.h" | 5 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_
connection.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "components/cryptauth/connection.h" | 8 #include "components/cryptauth/connection.h" |
| 9 | 9 |
| 10 namespace extensions { | 10 namespace extensions { |
| 11 | 11 |
| 12 static base::LazyInstance<BrowserContextKeyedAPIFactory< | 12 static base::LazyInstance<BrowserContextKeyedAPIFactory< |
| 13 ApiResourceManager<EasyUnlockPrivateConnection>>> g_factory = | 13 ApiResourceManager<EasyUnlockPrivateConnection>>>::DestructorAtExit |
| 14 LAZY_INSTANCE_INITIALIZER; | 14 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 15 | 15 |
| 16 template <> | 16 template <> |
| 17 BrowserContextKeyedAPIFactory<ApiResourceManager<EasyUnlockPrivateConnection>>* | 17 BrowserContextKeyedAPIFactory<ApiResourceManager<EasyUnlockPrivateConnection>>* |
| 18 ApiResourceManager<EasyUnlockPrivateConnection>::GetFactoryInstance() { | 18 ApiResourceManager<EasyUnlockPrivateConnection>::GetFactoryInstance() { |
| 19 return g_factory.Pointer(); | 19 return g_factory.Pointer(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 EasyUnlockPrivateConnection::EasyUnlockPrivateConnection( | 22 EasyUnlockPrivateConnection::EasyUnlockPrivateConnection( |
| 23 bool persistent, | 23 bool persistent, |
| 24 const std::string& owner_extension_id, | 24 const std::string& owner_extension_id, |
| 25 std::unique_ptr<cryptauth::Connection> connection) | 25 std::unique_ptr<cryptauth::Connection> connection) |
| 26 : ApiResource(owner_extension_id), | 26 : ApiResource(owner_extension_id), |
| 27 persistent_(persistent), | 27 persistent_(persistent), |
| 28 connection_(connection.release()) {} | 28 connection_(connection.release()) {} |
| 29 | 29 |
| 30 EasyUnlockPrivateConnection::~EasyUnlockPrivateConnection() {} | 30 EasyUnlockPrivateConnection::~EasyUnlockPrivateConnection() {} |
| 31 | 31 |
| 32 cryptauth::Connection* EasyUnlockPrivateConnection::GetConnection() const { | 32 cryptauth::Connection* EasyUnlockPrivateConnection::GetConnection() const { |
| 33 return connection_.get(); | 33 return connection_.get(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool EasyUnlockPrivateConnection::IsPersistent() const { | 36 bool EasyUnlockPrivateConnection::IsPersistent() const { |
| 37 return persistent_; | 37 return persistent_; |
| 38 } | 38 } |
| 39 | 39 |
| 40 } // namespace extensions | 40 } // namespace extensions |
| OLD | NEW |