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) { |