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

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: 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..5287ffe31d40124caa5ad74cc08e2305856886c4 100644
--- a/chrome/browser/extensions/api/identity/identity_api.cc
+++ b/chrome/browser/extensions/api/identity/identity_api.cc
@@ -393,8 +393,13 @@ void IdentityGetAuthTokenFunction::OnGetTokenFailure(
#if defined(OS_CHROMEOS)
void IdentityGetAuthTokenFunction::StartDeviceLoginAccessTokenRequest() {
- chromeos::DeviceOAuth2TokenService* service =
- chromeos::DeviceOAuth2TokenServiceFactory::Get();
+ chromeos::DeviceOAuth2TokenServiceFactory::Get(
+ base::Bind(&IdentityGetAuthTokenFunction::DidGetTokenService,
+ this));
pneubeck (no reviews) 2013/10/22 09:05:03 should this really rely on the ref-counting and po
satorux1 2013/10/22 09:56:43 Inside API functions, relying on ref counting is a
+}
+
+void IdentityGetAuthTokenFunction::DidGetTokenService(
+ chromeos::DeviceOAuth2TokenService* service) {
hashimoto 2013/10/22 08:49:51 nit: No need to have a NULL check here?
satorux1 2013/10/22 09:56:43 The original code didn't have one, but sounds like
Michael Courage 2013/10/23 00:22:47 When would the factory return NULL? Is this going
satorux1 2013/10/23 04:23:27 Per the header file [1], it can return NULL during
satorux1 2013/10/23 06:35:44 added: if (!service) { CompleteFunctionWith
// 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