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

Unified Diff: chrome/browser/extensions/api/identity/identity_api.cc

Issue 34523003: settings: Make DeviceOAuth2TokenServiceFactory::Get() async (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments 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/extensions/api/identity/identity_api.cc
diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc
index 485711e8be8eebae06df1ae73b4a274d067a56d3..2eabaae44e67e703c3905435b0e8fae8d07e8277 100644
--- a/chrome/browser/extensions/api/identity/identity_api.cc
+++ b/chrome/browser/extensions/api/identity/identity_api.cc
@@ -393,8 +393,17 @@ void IdentityGetAuthTokenFunction::OnGetTokenFailure(
#if defined(OS_CHROMEOS)
void IdentityGetAuthTokenFunction::StartDeviceLoginAccessTokenRequest() {
- chromeos::DeviceOAuth2TokenService* service =
- chromeos::DeviceOAuth2TokenServiceFactory::Get();
+ chromeos::DeviceOAuth2TokenServiceFactory::Get(
+ base::Bind(&IdentityGetAuthTokenFunction::DidGetTokenService,
+ this));
+}
+
+void IdentityGetAuthTokenFunction::DidGetTokenService(
+ chromeos::DeviceOAuth2TokenService* service) {
+ if (!service) {
+ CompleteFunctionWithError(identity_constants::kAuthFailure);
Michael Courage 2013/10/23 18:04:11 Can you change this to kUserNotSignedIn or a new s
satorux1 2013/10/24 01:49:26 Good catch. Changed to kUserNotSignedIn
+ return;
+ }
// Since robot account refresh tokens are scoped down to [any-api] only,
// request access token for [any-api] instead of login.
OAuth2TokenService::ScopeSet scopes;

Powered by Google App Engine
This is Rietveld 408576698