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_
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"
18 class EasyUnlockCreateKeysOperation
;
19 class EasyUnlockRemoveKeysOperation
;
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
{
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();
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_