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

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

Issue 2911583003: ChromeCryptAuthService: only perform device sync once enrollment is complete. (Closed)
Patch Set: Fix comment. 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..373985c0dc5a2e031b2571d38cec557781653754 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,30 @@ ChromeCryptAuthService::CreateCryptAuthClientFactory() {
return CreateCryptAuthClientFactoryImpl(profile_);
}
+void ChromeCryptAuthService::OnEnrollmentStarted() {}
+
+void ChromeCryptAuthService::OnEnrollmentFinished(bool success) {
khorimoto 2017/05/30 21:38:18 If !success, the device manager won't actually wor
Tim Song 2017/05/31 00:04:21 The enrollment manager should have its own retry l
Ryan Hansberry 2017/05/31 17:08:09 Done.
+ device_manager_->Start();
+ enrollment_manager_->RemoveObserver(this);
+}
+
void ChromeCryptAuthService::OnRefreshTokenAvailable(
const std::string& account_id) {
+ PA_LOG(ERROR) << "ChromeCAS: OnRefreshTokenAvailable";
khorimoto 2017/05/30 21:38:18 Remove these logs.
Ryan Hansberry 2017/05/31 17:08:09 Oops, removed.
if (account_id == GetAccountId()) {
+ PA_LOG(ERROR) << "ChromeCAS: OnRefreshTokenAvailable starting managers";
token_service_->RemoveObserver(this);
- enrollment_manager_->Start();
- device_manager_->Start();
+ PerformEnrollmentAndDeviceSync();
}
}
+
+void ChromeCryptAuthService::PerformEnrollmentAndDeviceSync() {
+ // If enrollment is not valid, wait for the new enrollment attempt to finish
khorimoto 2017/05/30 21:38:18 nit: This comment should probably be moved to the
Ryan Hansberry 2017/05/31 17:08:09 Done.
+ // before starting CryptAuthDeviceManager. See OnEnrollmentFinished(),
+ if (enrollment_manager_->IsEnrollmentValid())
+ device_manager_->Start();
+ else
+ enrollment_manager_->AddObserver(this);
+
+ enrollment_manager_->Start();
khorimoto 2017/05/30 21:38:18 Do we still need to call Start() here if the enrol
Ryan Hansberry 2017/05/31 17:08:09 Yes, in order for EnrollmentManager to schedule it
khorimoto 2017/05/31 17:53:38 nit: Thanks for the explanation - please add a com
Ryan Hansberry 2017/05/31 18:14:32 Done.
+}
« 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