Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / chromeos / login / easy_unlock / easy_unlock_remove_keys_operation.h
blobd09e601b442177a1d030ac4c292bc32c52ae2203
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_REMOVE_KEYS_OPERATION_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_REMOVE_KEYS_OPERATION_H_
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h"
11 #include "chromeos/login/auth/user_context.h"
12 #include "third_party/cros_system_api/dbus/service_constants.h"
14 namespace chromeos {
16 class UserContext;
18 // A class to remove existing Easy unlock cryptohome keys starting at given
19 // index.
20 class EasyUnlockRemoveKeysOperation {
21 public:
22 typedef base::Callback<void (bool success)> RemoveKeysCallback;
23 EasyUnlockRemoveKeysOperation(const UserContext& user_context,
24 size_t start_index,
25 const RemoveKeysCallback& callback);
26 ~EasyUnlockRemoveKeysOperation();
28 void Start();
30 private:
31 void OnGetSystemSalt(const std::string& system_salt);
33 void RemoveKey();
34 void OnKeyRemoved(bool success, cryptohome::MountError return_code);
36 UserContext user_context_;
37 RemoveKeysCallback callback_;
38 size_t key_index_;
39 base::WeakPtrFactory<EasyUnlockRemoveKeysOperation> weak_ptr_factory_;
41 DISALLOW_COPY_AND_ASSIGN(EasyUnlockRemoveKeysOperation);
44 } // namespace chromeos
46 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_REMOVE_KEYS_OPERATION_H_