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)); | |
399 } | |
400 | |
401 void IdentityGetAuthTokenFunction::DidGetTokenService( | |
402 chromeos::DeviceOAuth2TokenService* service) { | |
403 if (!service) { | |
404 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
| |
405 return; | |
406 } | |
398 // Since robot account refresh tokens are scoped down to [any-api] only, | 407 // Since robot account refresh tokens are scoped down to [any-api] only, |
399 // request access token for [any-api] instead of login. | 408 // request access token for [any-api] instead of login. |
400 OAuth2TokenService::ScopeSet scopes; | 409 OAuth2TokenService::ScopeSet scopes; |
401 scopes.insert(GaiaConstants::kAnyApiOAuth2Scope); | 410 scopes.insert(GaiaConstants::kAnyApiOAuth2Scope); |
402 login_token_request_ = | 411 login_token_request_ = |
403 service->StartRequest(service->GetRobotAccountId(), | 412 service->StartRequest(service->GetRobotAccountId(), |
404 scopes, | 413 scopes, |
405 this); | 414 this); |
406 } | 415 } |
407 #endif | 416 #endif |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
754 const IdentityAPI::TokenCacheKey& rhs) const { | 763 const IdentityAPI::TokenCacheKey& rhs) const { |
755 if (extension_id < rhs.extension_id) | 764 if (extension_id < rhs.extension_id) |
756 return true; | 765 return true; |
757 else if (rhs.extension_id < extension_id) | 766 else if (rhs.extension_id < extension_id) |
758 return false; | 767 return false; |
759 | 768 |
760 return scopes < rhs.scopes; | 769 return scopes < rhs.scopes; |
761 } | 770 } |
762 | 771 |
763 } // namespace extensions | 772 } // namespace extensions |
OLD | NEW |