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

Unified Diff: chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operation.cc

Issue 2343213002: chromeos: Avoid EasyUnlockGetKeysOperation D-Bus log spam. (Closed)
Patch Set: Created 4 years, 3 months 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
« no previous file with comments | « chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operation.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operation.cc
diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operation.cc b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operation.cc
index 46e75ebd451dac156da02008d275f70368580631..1fc777f4afbd305434106a82227339e38f55ef66 100644
--- a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operation.cc
+++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operation.cc
@@ -11,6 +11,8 @@
#include "base/bind.h"
#include "base/logging.h"
#include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
+#include "chromeos/dbus/cryptohome_client.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
#include "components/proximity_auth/logging/logging.h"
#include "components/signin/core/account_id/account_id.h"
#include "google_apis/gaia/gaia_auth_util.h"
@@ -30,6 +32,20 @@ EasyUnlockGetKeysOperation::~EasyUnlockGetKeysOperation() {
}
void EasyUnlockGetKeysOperation::Start() {
+ // Register for asynchronous notification of cryptohome being ready.
+ DBusThreadManager::Get()->GetCryptohomeClient()->WaitForServiceToBeAvailable(
+ base::Bind(&EasyUnlockGetKeysOperation::OnCryptohomeAvailable,
+ weak_ptr_factory_.GetWeakPtr()));
+}
+
+void EasyUnlockGetKeysOperation::OnCryptohomeAvailable(bool available) {
+ if (!available) {
+ PA_LOG(ERROR) << "Failed to wait for cryptohome to become available";
+ callback_.Run(false, EasyUnlockDeviceKeyDataList());
+ return;
+ }
+
+ // Start the asynchronous key fetch.
// TODO(xiyuan): Use ListKeyEx.
key_index_ = 0;
GetKeyData();
@@ -42,7 +58,6 @@ void EasyUnlockGetKeysOperation::GetKeyData() {
EasyUnlockKeyManager::GetKeyLabel(key_index_),
base::Bind(&EasyUnlockGetKeysOperation::OnGetKeyData,
weak_ptr_factory_.GetWeakPtr()));
-
}
void EasyUnlockGetKeysOperation::OnGetKeyData(
« no previous file with comments | « chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698