Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: chrome/browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_operation.cc

Issue 808563004: Clean up Smart Lock cryptohome keys logic: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: refactor scoped_ptr from deque Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #include "base/bind.h"
6 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_oper ation.h"
7 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_ope ration.h"
8 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_remove_keys_oper ation.h"
9
10 namespace chromeos {
11
12 EasyUnlockRefreshKeysOperation::EasyUnlockRefreshKeysOperation(
13 const UserContext& user_context,
14 const EasyUnlockDeviceKeyDataList& devices,
15 const RefreshKeysCallback& callback)
16 : user_context_(user_context),
17 devices_(devices),
18 callback_(callback),
19 weak_ptr_factory_(this) {
20 }
21
22 EasyUnlockRefreshKeysOperation::~EasyUnlockRefreshKeysOperation() {
23 }
24
25 void EasyUnlockRefreshKeysOperation::Start() {
26 if (devices_.empty()) {
27 OnKeysCreated(true);
28 return;
29 }
30
31 create_keys_operation_.reset(new EasyUnlockCreateKeysOperation(
32 user_context_, devices_,
33 base::Bind(&EasyUnlockRefreshKeysOperation::OnKeysCreated,
34 weak_ptr_factory_.GetWeakPtr())));
35 create_keys_operation_->Start();
36 }
37
38 void EasyUnlockRefreshKeysOperation::OnKeysCreated(bool success) {
39 if (!success) {
40 callback_.Run(false);
41 return;
42 }
43
44 remove_keys_operation_.reset(new EasyUnlockRemoveKeysOperation(
45 user_context_, devices_.size(),
46 base::Bind(&EasyUnlockRefreshKeysOperation::OnKeysRemoved,
47 weak_ptr_factory_.GetWeakPtr())));
48 remove_keys_operation_->Start();
49 }
50
51 void EasyUnlockRefreshKeysOperation::OnKeysRemoved(bool success) {
52 callback_.Run(success);
53 }
54
55 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698