OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/api/identity/identity_api.h" | 5 #include "chrome/browser/extensions/api/identity/identity_api.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 | 386 |
387 void IdentityGetAuthTokenFunction::OnGetTokenFailure( | 387 void IdentityGetAuthTokenFunction::OnGetTokenFailure( |
388 const OAuth2TokenService::Request* request, | 388 const OAuth2TokenService::Request* request, |
389 const GoogleServiceAuthError& error) { | 389 const GoogleServiceAuthError& error) { |
390 login_token_request_.reset(); | 390 login_token_request_.reset(); |
391 OnGaiaFlowFailure(GaiaWebAuthFlow::SERVICE_AUTH_ERROR, error, std::string()); | 391 OnGaiaFlowFailure(GaiaWebAuthFlow::SERVICE_AUTH_ERROR, error, std::string()); |
392 } | 392 } |
393 | 393 |
394 #if defined(OS_CHROMEOS) | 394 #if defined(OS_CHROMEOS) |
395 void IdentityGetAuthTokenFunction::StartDeviceLoginAccessTokenRequest() { | 395 void IdentityGetAuthTokenFunction::StartDeviceLoginAccessTokenRequest() { |
396 chromeos::DeviceOAuth2TokenService* service = | 396 chromeos::DeviceOAuth2TokenServiceFactory::Get( |
397 chromeos::DeviceOAuth2TokenServiceFactory::Get(); | 397 base::Bind(&IdentityGetAuthTokenFunction::DidGetTokenService, |
398 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
| |
399 } | |
400 | |
401 void IdentityGetAuthTokenFunction::DidGetTokenService( | |
402 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
| |
398 // Since robot account refresh tokens are scoped down to [any-api] only, | 403 // Since robot account refresh tokens are scoped down to [any-api] only, |
399 // request access token for [any-api] instead of login. | 404 // request access token for [any-api] instead of login. |
400 OAuth2TokenService::ScopeSet scopes; | 405 OAuth2TokenService::ScopeSet scopes; |
401 scopes.insert(GaiaConstants::kAnyApiOAuth2Scope); | 406 scopes.insert(GaiaConstants::kAnyApiOAuth2Scope); |
402 login_token_request_ = | 407 login_token_request_ = |
403 service->StartRequest(service->GetRobotAccountId(), | 408 service->StartRequest(service->GetRobotAccountId(), |
404 scopes, | 409 scopes, |
405 this); | 410 this); |
406 } | 411 } |
407 #endif | 412 #endif |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
754 const IdentityAPI::TokenCacheKey& rhs) const { | 759 const IdentityAPI::TokenCacheKey& rhs) const { |
755 if (extension_id < rhs.extension_id) | 760 if (extension_id < rhs.extension_id) |
756 return true; | 761 return true; |
757 else if (rhs.extension_id < extension_id) | 762 else if (rhs.extension_id < extension_id) |
758 return false; | 763 return false; |
759 | 764 |
760 return scopes < rhs.scopes; | 765 return scopes < rhs.scopes; |
761 } | 766 } |
762 | 767 |
763 } // namespace extensions | 768 } // namespace extensions |
OLD | NEW |