Index: chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.h |
diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.h b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f79ce92b05be104f4f05083a9fece0f8b8ea6f4d |
--- /dev/null |
+++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.h |
@@ -0,0 +1,58 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_CREATE_KEYS_OPERATION_H_ |
+#define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_CREATE_KEYS_OPERATION_H_ |
+ |
+#include "base/callback.h" |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h" |
+#include "chromeos/login/auth/user_context.h" |
+#include "third_party/cros_system_api/dbus/service_constants.h" |
+ |
+namespace chromeos { |
+ |
+class UserContext; |
+ |
+// A class to create Easy unlock cryptohome keys for the given user and devices. |
+class EasyUnlockCreateKeysOperation { |
+ public: |
+ typedef base::Callback<void (bool success)> CreateKeysCallback; |
+ EasyUnlockCreateKeysOperation( |
+ const UserContext& user_context, |
+ const EasyUnlockDeviceKeyDataList& devices, |
+ const CreateKeysCallback& callback); |
+ ~EasyUnlockCreateKeysOperation(); |
+ |
+ void Start(); |
+ |
+ private: |
+ class ChallengeCreator; |
+ |
+ void CreateKeyForDeviceAtIndex(size_t index); |
+ void OnChallengeCreated(size_t index, bool success); |
+ void OnGetSystemSalt(size_t index, |
+ const std::string& system_salt); |
+ void OnKeyCreated(size_t index, |
+ bool success, |
+ cryptohome::MountError return_code); |
+ |
+ UserContext user_context_; |
+ EasyUnlockDeviceKeyDataList devices_; |
+ CreateKeysCallback callback_; |
+ |
+ // Index of the key to be created. |
+ size_t key_creation_index_; |
+ |
+ scoped_ptr<ChallengeCreator> challenge_creator_; |
+ |
+ base::WeakPtrFactory<EasyUnlockCreateKeysOperation> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(EasyUnlockCreateKeysOperation); |
+}; |
+ |
+} // namespace chromeos |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_CREATE_KEYS_OPERATION_H_ |