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

Unified Diff: chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc

Issue 34523003: settings: Make DeviceOAuth2TokenServiceFactory::Get() async (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
Index: chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
diff --git a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
index 182b46a76d5d72869441f1b46e81bb88f537a64a..f766da17feddf0360bb43257228c05e5b733c783 100644
--- a/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
+++ b/chrome/browser/chromeos/policy/enrollment_handler_chromeos.cc
@@ -161,16 +161,21 @@ void EnrollmentHandlerChromeOS::OnStoreLoaded(CloudPolicyStore* store) {
// registration rolling again after the store finishes loading.
AttemptRegistration();
} else if (enrollment_step_ == STEP_STORE_POLICY) {
- // Store the robot API auth refresh token.
- // Currently optional, so always return success.
- chromeos::DeviceOAuth2TokenService* token_service =
- chromeos::DeviceOAuth2TokenServiceFactory::Get();
- if (token_service && !robot_refresh_token_.empty()) {
- token_service->SetAndSaveRefreshToken(robot_refresh_token_);
+ chromeos::DeviceOAuth2TokenServiceFactory::Get(
+ base::Bind(&EnrollmentHandlerChromeOS::DidGetTokenService,
+ weak_factory_.GetWeakPtr()));
pneubeck (no reviews) 2013/10/22 09:05:03 it needs some reading of the code to see whether i
satorux1 2013/10/22 09:56:43 good point. will take another look tomorrow.
satorux1 2013/10/23 06:35:44 Took a look. It wasn't clear if it's safe to use t
+ }
+}
+
+void EnrollmentHandlerChromeOS::DidGetTokenService(
+ chromeos::DeviceOAuth2TokenService* token_service) {
+ // Store the robot API auth refresh token.
+ // Currently optional, so always return success.
+ if (token_service && !robot_refresh_token_.empty()) {
+ token_service->SetAndSaveRefreshToken(robot_refresh_token_);
hashimoto 2013/10/22 08:49:51 nit: No need to have a blank line here?
pneubeck (no reviews) 2013/10/22 09:05:03 nit: remove { } and empty line
satorux1 2013/10/22 09:56:43 Will fix.
satorux1 2013/10/22 09:56:43 will fix.
satorux1 2013/10/23 06:35:44 Done.
- }
- ReportResult(EnrollmentStatus::ForStatus(EnrollmentStatus::STATUS_SUCCESS));
}
+ ReportResult(EnrollmentStatus::ForStatus(EnrollmentStatus::STATUS_SUCCESS));
}
void EnrollmentHandlerChromeOS::OnStoreError(CloudPolicyStore* store) {

Powered by Google App Engine
This is Rietveld 408576698