OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_CR
YPTO_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CR
YPTO_DELEGATE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CR
YPTO_DELEGATE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CR
YPTO_DELEGATE_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/callback.h" | 11 #include "base/callback.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "chrome/common/extensions/api/easy_unlock_private.h" | 12 #include "chrome/common/extensions/api/easy_unlock_private.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 // Wrapper around EasyUnlock dbus client on Chrome OS. The methods read | 16 // Wrapper around EasyUnlock dbus client on Chrome OS. The methods read |
17 // extension function pearameters and invoke the associated EasyUnlock dbus | 17 // extension function pearameters and invoke the associated EasyUnlock dbus |
18 // client methods. On non-Chrome OS platforms, the methods are stubbed out. | 18 // client methods. On non-Chrome OS platforms, the methods are stubbed out. |
19 class EasyUnlockPrivateCryptoDelegate { | 19 class EasyUnlockPrivateCryptoDelegate { |
20 public: | 20 public: |
21 typedef base::Callback<void(const std::string& data)> DataCallback; | 21 typedef base::Callback<void(const std::string& data)> DataCallback; |
22 | 22 |
23 typedef base::Callback<void(const std::string& public_key, | 23 typedef base::Callback<void(const std::string& public_key, |
24 const std::string& private_key)> | 24 const std::string& private_key)> |
25 KeyPairCallback; | 25 KeyPairCallback; |
26 | 26 |
27 virtual ~EasyUnlockPrivateCryptoDelegate() {} | 27 virtual ~EasyUnlockPrivateCryptoDelegate() {} |
28 | 28 |
29 // Creates platform specific delegate instance. Non Chrome OS implementations | 29 // Creates platform specific delegate instance. Non Chrome OS implementations |
30 // currently do nothing but invoke callbacks with empty data. | 30 // currently do nothing but invoke callbacks with empty data. |
31 static scoped_ptr<EasyUnlockPrivateCryptoDelegate> Create(); | 31 static std::unique_ptr<EasyUnlockPrivateCryptoDelegate> Create(); |
32 | 32 |
33 // See chromeos/dbus/easy_unlock_client.h for info on these methods. | 33 // See chromeos/dbus/easy_unlock_client.h for info on these methods. |
34 virtual void GenerateEcP256KeyPair(const KeyPairCallback& callback) = 0; | 34 virtual void GenerateEcP256KeyPair(const KeyPairCallback& callback) = 0; |
35 virtual void PerformECDHKeyAgreement( | 35 virtual void PerformECDHKeyAgreement( |
36 const api::easy_unlock_private::PerformECDHKeyAgreement::Params& params, | 36 const api::easy_unlock_private::PerformECDHKeyAgreement::Params& params, |
37 const DataCallback& callback) = 0; | 37 const DataCallback& callback) = 0; |
38 virtual void CreateSecureMessage( | 38 virtual void CreateSecureMessage( |
39 const api::easy_unlock_private::CreateSecureMessage::Params& params, | 39 const api::easy_unlock_private::CreateSecureMessage::Params& params, |
40 const DataCallback& callback) = 0; | 40 const DataCallback& callback) = 0; |
41 virtual void UnwrapSecureMessage( | 41 virtual void UnwrapSecureMessage( |
42 const api::easy_unlock_private::UnwrapSecureMessage::Params& params, | 42 const api::easy_unlock_private::UnwrapSecureMessage::Params& params, |
43 const DataCallback& callback) = 0; | 43 const DataCallback& callback) = 0; |
44 }; | 44 }; |
45 | 45 |
46 } // namespace extensions | 46 } // namespace extensions |
47 | 47 |
48 #endif // CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE
_CRYPTO_DELEGATE_H_ | 48 #endif // CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE
_CRYPTO_DELEGATE_H_ |
OLD | NEW |