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