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