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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_operation.cc
diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_operation.cc b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_operation.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f99cf4d3b094ac83c61adf33f933926a5c9207fd
--- /dev/null
+++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_operation.cc
@@ -0,0 +1,55 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/bind.h"
+#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.h"
+#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_operation.h"
+#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_remove_keys_operation.h"
+
+namespace chromeos {
+
+EasyUnlockRefreshKeysOperation::EasyUnlockRefreshKeysOperation(
+ const UserContext& user_context,
+ const EasyUnlockDeviceKeyDataList& devices,
+ const RefreshKeysCallback& callback)
+ : user_context_(user_context),
+ devices_(devices),
+ callback_(callback),
+ weak_ptr_factory_(this) {
+}
+
+EasyUnlockRefreshKeysOperation::~EasyUnlockRefreshKeysOperation() {
+}
+
+void EasyUnlockRefreshKeysOperation::Start() {
+ if (devices_.empty()) {
+ OnKeysCreated(true);
+ return;
+ }
+
+ create_keys_operation_.reset(new EasyUnlockCreateKeysOperation(
+ user_context_, devices_,
+ base::Bind(&EasyUnlockRefreshKeysOperation::OnKeysCreated,
+ weak_ptr_factory_.GetWeakPtr())));
+ create_keys_operation_->Start();
+}
+
+void EasyUnlockRefreshKeysOperation::OnKeysCreated(bool success) {
+ if (!success) {
+ callback_.Run(false);
+ return;
+ }
+
+ remove_keys_operation_.reset(new EasyUnlockRemoveKeysOperation(
+ 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.
+ base::Bind(&EasyUnlockRefreshKeysOperation::OnKeysRemoved,
+ weak_ptr_factory_.GetWeakPtr())));
+ remove_keys_operation_->Start();
+}
+
+void EasyUnlockRefreshKeysOperation::OnKeysRemoved(bool success) {
+ callback_.Run(success);
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698