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

Unified Diff: chrome/browser/cryptauth/chrome_cryptauth_service.cc

Issue 2911583003: ChromeCryptAuthService: only perform device sync once enrollment is complete. (Closed)
Patch Set: khorimoto@ comments. Created 3 years, 7 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/cryptauth/chrome_cryptauth_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cryptauth/chrome_cryptauth_service.cc
diff --git a/chrome/browser/cryptauth/chrome_cryptauth_service.cc b/chrome/browser/cryptauth/chrome_cryptauth_service.cc
index cb91f83f7a8b8bd94c372ba785ffd595f578a532..147e575f26d16cd843ded1fc2874830cc03b222c 100644
--- a/chrome/browser/cryptauth/chrome_cryptauth_service.cc
+++ b/chrome/browser/cryptauth/chrome_cryptauth_service.cc
@@ -21,7 +21,6 @@
#include "components/cryptauth/cryptauth_device_manager.h"
#include "components/cryptauth/cryptauth_enroller.h"
#include "components/cryptauth/cryptauth_enroller_impl.h"
-#include "components/cryptauth/cryptauth_enrollment_manager.h"
#include "components/cryptauth/cryptauth_enrollment_utils.h"
#include "components/cryptauth/cryptauth_gcm_manager_impl.h"
#include "components/cryptauth/proto/cryptauth_api.pb.h"
@@ -226,8 +225,7 @@ ChromeCryptAuthService::ChromeCryptAuthService(
<< "waiting before starting CryptAuth managers.";
token_service_->AddObserver(this);
} else {
- enrollment_manager_->Start();
- device_manager_->Start();
+ PerformEnrollmentAndDeviceSync();
}
}
@@ -268,11 +266,32 @@ ChromeCryptAuthService::CreateCryptAuthClientFactory() {
return CreateCryptAuthClientFactoryImpl(profile_);
}
+void ChromeCryptAuthService::OnEnrollmentStarted() {}
+
+void ChromeCryptAuthService::OnEnrollmentFinished(bool success) {
+ if (!success)
+ return;
khorimoto 2017/05/31 17:30:06 What do we expect to happen in this case? Should w
Ryan Hansberry 2017/05/31 17:43:50 Looking at EnrollmentManager, it looks like it giv
+
+ device_manager_->Start();
+ enrollment_manager_->RemoveObserver(this);
+}
+
void ChromeCryptAuthService::OnRefreshTokenAvailable(
const std::string& account_id) {
if (account_id == GetAccountId()) {
token_service_->RemoveObserver(this);
- enrollment_manager_->Start();
+ PerformEnrollmentAndDeviceSync();
+ }
+}
+
+void ChromeCryptAuthService::PerformEnrollmentAndDeviceSync() {
+ if (enrollment_manager_->IsEnrollmentValid()) {
device_manager_->Start();
+ } else {
+ // If enrollment is not valid, wait for the new enrollment attempt to finish
+ // before starting CryptAuthDeviceManager. See OnEnrollmentFinished(),
+ enrollment_manager_->AddObserver(this);
}
+
+ enrollment_manager_->Start();
}
« no previous file with comments | « chrome/browser/cryptauth/chrome_cryptauth_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698