OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // TODO(dkrahn): Clean up this private API once all clients have been migrated | 5 // TODO(dkrahn): Clean up this private API once all clients have been migrated |
6 // to use the public API. crbug.com/588339. | 6 // to use the public API. crbug.com/588339. |
7 | 7 |
8 #ifndef CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_PRIVATE_ENTERPRIS
E_PLATFORM_KEYS_PRIVATE_API_H__ | 8 #ifndef CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_PRIVATE_ENTERPRIS
E_PLATFORM_KEYS_PRIVATE_API_H__ |
9 #define CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_PRIVATE_ENTERPRIS
E_PLATFORM_KEYS_PRIVATE_API_H__ | 9 #define CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_PRIVATE_ENTERPRIS
E_PLATFORM_KEYS_PRIVATE_API_H__ |
10 | 10 |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 | 13 |
13 #include "base/callback.h" | 14 #include "base/callback.h" |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "chrome/common/extensions/api/enterprise_platform_keys_private.h" | 16 #include "chrome/common/extensions/api/enterprise_platform_keys_private.h" |
17 #include "chromeos/attestation/attestation_constants.h" | 17 #include "chromeos/attestation/attestation_constants.h" |
18 #include "chromeos/attestation/attestation_flow.h" | 18 #include "chromeos/attestation/attestation_flow.h" |
19 #include "chromeos/dbus/cryptohome_client.h" | 19 #include "chromeos/dbus/cryptohome_client.h" |
20 #include "chromeos/dbus/dbus_method_call_status.h" | 20 #include "chromeos/dbus/dbus_method_call_status.h" |
21 #include "components/signin/core/account_id/account_id.h" | 21 #include "components/signin/core/account_id/account_id.h" |
22 #include "extensions/browser/extension_function.h" | 22 #include "extensions/browser/extension_function.h" |
23 #include "third_party/cros_system_api/dbus/service_constants.h" | 23 #include "third_party/cros_system_api/dbus/service_constants.h" |
24 | 24 |
25 class PrefService; | 25 class PrefService; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 chromeos::attestation::AttestationKeyType key_type, | 109 chromeos::attestation::AttestationKeyType key_type, |
110 const AccountId& account_id, | 110 const AccountId& account_id, |
111 const std::string& key_name, | 111 const std::string& key_name, |
112 chromeos::attestation::AttestationCertificateProfile certificate_profile, | 112 chromeos::attestation::AttestationCertificateProfile certificate_profile, |
113 bool require_user_consent, | 113 bool require_user_consent, |
114 const base::Callback<void(PrepareKeyResult)>& callback); | 114 const base::Callback<void(PrepareKeyResult)>& callback); |
115 | 115 |
116 chromeos::CryptohomeClient* cryptohome_client_; | 116 chromeos::CryptohomeClient* cryptohome_client_; |
117 cryptohome::AsyncMethodCaller* async_caller_; | 117 cryptohome::AsyncMethodCaller* async_caller_; |
118 chromeos::attestation::AttestationFlow* attestation_flow_; | 118 chromeos::attestation::AttestationFlow* attestation_flow_; |
119 scoped_ptr<chromeos::attestation::AttestationFlow> default_attestation_flow_; | 119 std::unique_ptr<chromeos::attestation::AttestationFlow> |
| 120 default_attestation_flow_; |
120 ChallengeKeyCallback callback_; | 121 ChallengeKeyCallback callback_; |
121 Profile* profile_; | 122 Profile* profile_; |
122 std::string extension_id_; | 123 std::string extension_id_; |
123 | 124 |
124 private: | 125 private: |
125 // Holds the context of a PrepareKey() operation. | 126 // Holds the context of a PrepareKey() operation. |
126 struct PrepareKeyContext { | 127 struct PrepareKeyContext { |
127 PrepareKeyContext(chromeos::attestation::AttestationKeyType key_type, | 128 PrepareKeyContext(chromeos::attestation::AttestationKeyType key_type, |
128 const AccountId& account_id, | 129 const AccountId& account_id, |
129 const std::string& key_name, | 130 const std::string& key_name, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 254 |
254 private: | 255 private: |
255 ~EnterprisePlatformKeysPrivateChallengeMachineKeyFunction() override; | 256 ~EnterprisePlatformKeysPrivateChallengeMachineKeyFunction() override; |
256 ResponseAction Run() override; | 257 ResponseAction Run() override; |
257 | 258 |
258 // Called when the challenge operation is complete. If the operation succeeded | 259 // Called when the challenge operation is complete. If the operation succeeded |
259 // |success| will be true and |data| will contain the challenge response data. | 260 // |success| will be true and |data| will contain the challenge response data. |
260 // Otherwise |success| will be false and |data| is an error message. | 261 // Otherwise |success| will be false and |data| is an error message. |
261 void OnChallengedKey(bool success, const std::string& data); | 262 void OnChallengedKey(bool success, const std::string& data); |
262 | 263 |
263 scoped_ptr<EPKPChallengeMachineKey> default_impl_; | 264 std::unique_ptr<EPKPChallengeMachineKey> default_impl_; |
264 EPKPChallengeMachineKey* impl_; | 265 EPKPChallengeMachineKey* impl_; |
265 | 266 |
266 DECLARE_EXTENSION_FUNCTION( | 267 DECLARE_EXTENSION_FUNCTION( |
267 "enterprise.platformKeysPrivate.challengeMachineKey", | 268 "enterprise.platformKeysPrivate.challengeMachineKey", |
268 ENTERPRISE_PLATFORMKEYSPRIVATE_CHALLENGEMACHINEKEY); | 269 ENTERPRISE_PLATFORMKEYSPRIVATE_CHALLENGEMACHINEKEY); |
269 }; | 270 }; |
270 | 271 |
271 class EnterprisePlatformKeysPrivateChallengeUserKeyFunction | 272 class EnterprisePlatformKeysPrivateChallengeUserKeyFunction |
272 : public UIThreadExtensionFunction { | 273 : public UIThreadExtensionFunction { |
273 public: | 274 public: |
274 EnterprisePlatformKeysPrivateChallengeUserKeyFunction(); | 275 EnterprisePlatformKeysPrivateChallengeUserKeyFunction(); |
275 explicit EnterprisePlatformKeysPrivateChallengeUserKeyFunction( | 276 explicit EnterprisePlatformKeysPrivateChallengeUserKeyFunction( |
276 EPKPChallengeUserKey* impl_for_testing); | 277 EPKPChallengeUserKey* impl_for_testing); |
277 | 278 |
278 private: | 279 private: |
279 ~EnterprisePlatformKeysPrivateChallengeUserKeyFunction() override; | 280 ~EnterprisePlatformKeysPrivateChallengeUserKeyFunction() override; |
280 ResponseAction Run() override; | 281 ResponseAction Run() override; |
281 | 282 |
282 // Called when the challenge operation is complete. If the operation succeeded | 283 // Called when the challenge operation is complete. If the operation succeeded |
283 // |success| will be true and |data| will contain the challenge response data. | 284 // |success| will be true and |data| will contain the challenge response data. |
284 // Otherwise |success| will be false and |data| is an error message. | 285 // Otherwise |success| will be false and |data| is an error message. |
285 void OnChallengedKey(bool success, const std::string& data); | 286 void OnChallengedKey(bool success, const std::string& data); |
286 | 287 |
287 scoped_ptr<EPKPChallengeUserKey> default_impl_; | 288 std::unique_ptr<EPKPChallengeUserKey> default_impl_; |
288 EPKPChallengeUserKey* impl_; | 289 EPKPChallengeUserKey* impl_; |
289 | 290 |
290 DECLARE_EXTENSION_FUNCTION( | 291 DECLARE_EXTENSION_FUNCTION( |
291 "enterprise.platformKeysPrivate.challengeUserKey", | 292 "enterprise.platformKeysPrivate.challengeUserKey", |
292 ENTERPRISE_PLATFORMKEYSPRIVATE_CHALLENGEUSERKEY); | 293 ENTERPRISE_PLATFORMKEYSPRIVATE_CHALLENGEUSERKEY); |
293 }; | 294 }; |
294 | 295 |
295 } // namespace extensions | 296 } // namespace extensions |
296 | 297 |
297 #endif // CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_PRIVATE_ENTERP
RISE_PLATFORM_KEYS_PRIVATE_API_H__ | 298 #endif // CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_PLATFORM_KEYS_PRIVATE_ENTERP
RISE_PLATFORM_KEYS_PRIVATE_API_H__ |
OLD | NEW |