| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/signin/core/browser/profile_oauth2_token_service.h" | 5 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "components/signin/core/browser/signin_client.h" |
| 11 #include "components/signin/core/browser/signin_error_controller.h" | 12 #include "components/signin/core/browser/signin_error_controller.h" |
| 13 #include "google_apis/gaia/gaia_auth_util.h" |
| 12 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.h" |
| 13 | 15 |
| 14 ProfileOAuth2TokenService::ProfileOAuth2TokenService() | 16 ProfileOAuth2TokenService::ProfileOAuth2TokenService() |
| 15 : client_(NULL) {} | 17 : client_(NULL) {} |
| 16 | 18 |
| 17 ProfileOAuth2TokenService::~ProfileOAuth2TokenService() { | 19 ProfileOAuth2TokenService::~ProfileOAuth2TokenService() { |
| 18 DCHECK(!signin_error_controller_.get()) << | 20 DCHECK(!signin_error_controller_.get()) << |
| 19 "ProfileOAuth2TokenService::Initialize called but not " | 21 "ProfileOAuth2TokenService::Initialize called but not " |
| 20 "ProfileOAuth2TokenService::Shutdown"; | 22 "ProfileOAuth2TokenService::Shutdown"; |
| 21 } | 23 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 36 net::URLRequestContextGetter* ProfileOAuth2TokenService::GetRequestContext() { | 38 net::URLRequestContextGetter* ProfileOAuth2TokenService::GetRequestContext() { |
| 37 return NULL; | 39 return NULL; |
| 38 } | 40 } |
| 39 | 41 |
| 40 void ProfileOAuth2TokenService::UpdateAuthError( | 42 void ProfileOAuth2TokenService::UpdateAuthError( |
| 41 const std::string& account_id, | 43 const std::string& account_id, |
| 42 const GoogleServiceAuthError& error) { | 44 const GoogleServiceAuthError& error) { |
| 43 NOTREACHED(); | 45 NOTREACHED(); |
| 44 } | 46 } |
| 45 | 47 |
| 48 void ProfileOAuth2TokenService::ValidateAccountId( |
| 49 const std::string& account_id) const { |
| 50 DCHECK(!account_id.empty()); |
| 51 |
| 52 // If the account is given as an email, make sure its a canonical email. |
| 53 // Note that some tests don't use email strings as account id, and after |
| 54 // the gaia id migration it won't be an email. So only check for |
| 55 // canonicalization if the account_id is suspected to be an email. |
| 56 if (account_id.find('@') != std::string::npos) |
| 57 DCHECK_EQ(gaia::CanonicalizeEmail(account_id), account_id); |
| 58 } |
| 59 |
| 46 std::vector<std::string> ProfileOAuth2TokenService::GetAccounts() { | 60 std::vector<std::string> ProfileOAuth2TokenService::GetAccounts() { |
| 47 NOTREACHED(); | 61 NOTREACHED(); |
| 48 return std::vector<std::string>(); | 62 return std::vector<std::string>(); |
| 49 } | 63 } |
| 50 | 64 |
| 51 void ProfileOAuth2TokenService::LoadCredentials( | 65 void ProfileOAuth2TokenService::LoadCredentials( |
| 52 const std::string& primary_account_id) { | 66 const std::string& primary_account_id) { |
| 53 // Empty implementation by default. | 67 // Empty implementation by default. |
| 54 } | 68 } |
| 55 | 69 |
| 56 void ProfileOAuth2TokenService::UpdateCredentials( | 70 void ProfileOAuth2TokenService::UpdateCredentials( |
| 57 const std::string& account_id, | 71 const std::string& account_id, |
| 58 const std::string& refresh_token) { | 72 const std::string& refresh_token) { |
| 59 NOTREACHED(); | 73 NOTREACHED(); |
| 60 } | 74 } |
| 61 | 75 |
| 62 void ProfileOAuth2TokenService::RevokeAllCredentials() { | 76 void ProfileOAuth2TokenService::RevokeAllCredentials() { |
| 63 // Empty implementation by default. | 77 // Empty implementation by default. |
| 64 } | 78 } |
| 65 | |
| OLD | NEW |