OLD | NEW |
---|---|
(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(), | |
xiyuan
2014/12/17 00:23:14
Think we need to follow existing code to use the u
Tim Song
2014/12/17 02:05:14
Hmm... I tested this and easy sign-in still works
xiyuan
2014/12/17 03:26:33
This works now because we have one and only one ke
Tim Song
2014/12/17 20:57:57
Done.
| |
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 | |
OLD | NEW |