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_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_CREATE_KEYS_OPERAT
ION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_CREATE_KEYS_OPERAT
ION_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_CREATE_KEYS_OPERAT
ION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_CREATE_KEYS_OPERAT
ION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h" | 13 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h" |
14 #include "chromeos/login/auth/user_context.h" | 14 #include "chromeos/login/auth/user_context.h" |
15 #include "third_party/cros_system_api/dbus/service_constants.h" | 15 #include "third_party/cros_system_api/dbus/service_constants.h" |
16 | 16 |
17 namespace chromeos { | 17 namespace chromeos { |
18 | 18 |
19 class UserContext; | 19 class UserContext; |
20 | 20 |
21 // A class to create Easy unlock cryptohome keys for the given user and devices. | 21 // A class to create Easy unlock cryptohome keys for the given user and devices. |
22 class EasyUnlockCreateKeysOperation { | 22 class EasyUnlockCreateKeysOperation { |
23 public: | 23 public: |
24 typedef base::Callback<void (bool success)> CreateKeysCallback; | 24 typedef base::Callback<void (bool success)> CreateKeysCallback; |
25 EasyUnlockCreateKeysOperation( | 25 EasyUnlockCreateKeysOperation( |
26 const UserContext& user_context, | 26 const UserContext& user_context, |
| 27 const std::string& tpm_public_key, |
27 const EasyUnlockDeviceKeyDataList& devices, | 28 const EasyUnlockDeviceKeyDataList& devices, |
28 const CreateKeysCallback& callback); | 29 const CreateKeysCallback& callback); |
29 ~EasyUnlockCreateKeysOperation(); | 30 ~EasyUnlockCreateKeysOperation(); |
30 | 31 |
31 void Start(); | 32 void Start(); |
32 | 33 |
33 const UserContext& user_context() const { return user_context_; } | 34 const UserContext& user_context() const { return user_context_; } |
34 | 35 |
35 private: | 36 private: |
36 class ChallengeCreator; | 37 class ChallengeCreator; |
37 | 38 |
38 void CreateKeyForDeviceAtIndex(size_t index); | 39 void CreateKeyForDeviceAtIndex(size_t index); |
39 void OnChallengeCreated(size_t index, bool success); | 40 void OnChallengeCreated(size_t index, bool success); |
40 void OnGetSystemSalt(size_t index, | 41 void OnGetSystemSalt(size_t index, |
41 const std::string& system_salt); | 42 const std::string& system_salt); |
42 void OnKeyCreated(size_t index, | 43 void OnKeyCreated(size_t index, |
43 const Key& user_key, | 44 const Key& user_key, |
44 bool success, | 45 bool success, |
45 cryptohome::MountError return_code); | 46 cryptohome::MountError return_code); |
46 | 47 |
47 UserContext user_context_; | 48 UserContext user_context_; |
| 49 std::string tpm_public_key_; |
48 EasyUnlockDeviceKeyDataList devices_; | 50 EasyUnlockDeviceKeyDataList devices_; |
49 CreateKeysCallback callback_; | 51 CreateKeysCallback callback_; |
50 | 52 |
51 // Index of the key to be created. | 53 // Index of the key to be created. |
52 size_t key_creation_index_; | 54 size_t key_creation_index_; |
53 | 55 |
54 scoped_ptr<ChallengeCreator> challenge_creator_; | 56 scoped_ptr<ChallengeCreator> challenge_creator_; |
55 | 57 |
56 base::WeakPtrFactory<EasyUnlockCreateKeysOperation> weak_ptr_factory_; | 58 base::WeakPtrFactory<EasyUnlockCreateKeysOperation> weak_ptr_factory_; |
57 | 59 |
58 DISALLOW_COPY_AND_ASSIGN(EasyUnlockCreateKeysOperation); | 60 DISALLOW_COPY_AND_ASSIGN(EasyUnlockCreateKeysOperation); |
59 }; | 61 }; |
60 | 62 |
61 } // namespace chromeos | 63 } // namespace chromeos |
62 | 64 |
63 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_CREATE_KEYS_OPE
RATION_H_ | 65 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_CREATE_KEYS_OPE
RATION_H_ |
OLD | NEW |