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 #ifndef CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CO
NNECTION_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CO
NNECTION_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CO
NNECTION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CO
NNECTION_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "extensions/browser/api/api_resource.h" | 11 #include "extensions/browser/api/api_resource.h" |
12 #include "extensions/browser/api/api_resource_manager.h" | 12 #include "extensions/browser/api/api_resource_manager.h" |
13 | 13 |
14 namespace proximity_auth { | 14 namespace cryptauth { |
15 class Connection; | 15 class Connection; |
16 } // namespace proximity_auth | 16 } // namespace cryptauth |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 // An ApiResource wrapper for a proximity_auth::Connection. | 19 // An ApiResource wrapper for a cryptauth::Connection. |
20 class EasyUnlockPrivateConnection : public ApiResource { | 20 class EasyUnlockPrivateConnection : public ApiResource { |
21 public: | 21 public: |
22 EasyUnlockPrivateConnection( | 22 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<proximity_auth::Connection> connection); | 25 std::unique_ptr<cryptauth::Connection> connection); |
26 ~EasyUnlockPrivateConnection() override; | 26 ~EasyUnlockPrivateConnection() override; |
27 | 27 |
28 // Returns a pointer to the underlying connection object. | 28 // Returns a pointer to the underlying connection object. |
29 proximity_auth::Connection* GetConnection() const; | 29 cryptauth::Connection* GetConnection() const; |
30 | 30 |
31 // ApiResource override. | 31 // ApiResource override. |
32 bool IsPersistent() const override; | 32 bool IsPersistent() const override; |
33 | 33 |
34 // This resource should be managed on the UI thread. | 34 // This resource should be managed on the UI thread. |
35 static const content::BrowserThread::ID kThreadId = | 35 static const content::BrowserThread::ID kThreadId = |
36 content::BrowserThread::UI; | 36 content::BrowserThread::UI; |
37 | 37 |
38 private: | 38 private: |
39 friend class ApiResourceManager<EasyUnlockPrivateConnection>; | 39 friend class ApiResourceManager<EasyUnlockPrivateConnection>; |
40 static const char* service_name() { | 40 static const char* service_name() { |
41 return "EasyUnlockPrivateConnectionManager"; | 41 return "EasyUnlockPrivateConnectionManager"; |
42 } | 42 } |
43 | 43 |
44 // True, if this resource should be persistent. | 44 // True, if this resource should be persistent. |
45 bool persistent_; | 45 bool persistent_; |
46 | 46 |
47 // The connection is owned by this instance and will automatically disconnect | 47 // The connection is owned by this instance and will automatically disconnect |
48 // when deleted. | 48 // when deleted. |
49 std::unique_ptr<proximity_auth::Connection> connection_; | 49 std::unique_ptr<cryptauth::Connection> connection_; |
50 | 50 |
51 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateConnection); | 51 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateConnection); |
52 }; | 52 }; |
53 | 53 |
54 } // namespace extensions | 54 } // namespace extensions |
55 | 55 |
56 #endif // CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE
_CONNECTION_H_ | 56 #endif // CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE
_CONNECTION_H_ |
OLD | NEW |