Elim cr-checkbox
[chromium-blink-merge.git] / chrome / browser / chromeos / login / easy_unlock / easy_unlock_refresh_keys_operation.h
blobf99b97ed20476dd251f41e5c3d4fa356b793c48e
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.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_REFRESH_KEYS_OPERATION_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_REFRESH_KEYS_OPERATION_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h"
14 #include "chromeos/login/auth/user_context.h"
16 namespace chromeos {
18 class EasyUnlockCreateKeysOperation;
19 class EasyUnlockRemoveKeysOperation;
20 class UserContext;
22 // The refresh keys operation replaces the existing keys in cryptohome with a
23 // new list of keys. This operation is a simple sequence of the create and
24 // remove keys operations.
25 class EasyUnlockRefreshKeysOperation {
26 public:
27 typedef base::Callback<void(bool success)> RefreshKeysCallback;
28 EasyUnlockRefreshKeysOperation(const UserContext& user_context,
29 const std::string& tpm_public_key,
30 const EasyUnlockDeviceKeyDataList& devices,
31 const RefreshKeysCallback& callback);
32 ~EasyUnlockRefreshKeysOperation();
34 void Start();
36 private:
37 void OnKeysCreated(bool success);
38 void OnKeysRemoved(bool success);
40 UserContext user_context_;
41 std::string tpm_public_key_;
42 EasyUnlockDeviceKeyDataList devices_;
43 RefreshKeysCallback callback_;
45 scoped_ptr<EasyUnlockCreateKeysOperation> create_keys_operation_;
46 scoped_ptr<EasyUnlockRemoveKeysOperation> remove_keys_operation_;
48 base::WeakPtrFactory<EasyUnlockRefreshKeysOperation> weak_ptr_factory_;
50 DISALLOW_COPY_AND_ASSIGN(EasyUnlockRefreshKeysOperation);
53 } // namespace chromeos
55 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_REFRESH_KEYS_OPERATION_H_