OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/signin/token_service.h" | 5 #include "chrome/browser/signin/token_service.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 103 } |
104 | 104 |
105 // Services dependent on a token will check if a token is available. | 105 // Services dependent on a token will check if a token is available. |
106 // If it isn't, they'll go to sleep until they get a token event. | 106 // If it isn't, they'll go to sleep until they get a token event. |
107 bool TokenService::HasTokenForService(const char* service) const { | 107 bool TokenService::HasTokenForService(const char* service) const { |
108 return false; | 108 return false; |
109 } | 109 } |
110 | 110 |
111 const std::string& TokenService::GetTokenForService( | 111 const std::string& TokenService::GetTokenForService( |
112 const char* const service) const { | 112 const char* const service) const { |
113 return EmptyString(); | 113 return base::EmptyString(); |
114 } | 114 } |
115 | 115 |
116 bool TokenService::HasOAuthLoginToken() const { | 116 bool TokenService::HasOAuthLoginToken() const { |
117 ProfileOAuth2TokenService* service = | 117 ProfileOAuth2TokenService* service = |
118 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); | 118 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
119 return service->RefreshTokenIsAvailable(service->GetPrimaryAccountId()); | 119 return service->RefreshTokenIsAvailable(service->GetPrimaryAccountId()); |
120 } | 120 } |
121 | 121 |
122 void TokenService::IssueAuthTokenForTest(const std::string& service, | 122 void TokenService::IssueAuthTokenForTest(const std::string& service, |
123 const std::string& auth_token) { | 123 const std::string& auth_token) { |
124 // Only issue oauth2 tokens. | 124 // Only issue oauth2 tokens. |
125 if (profile_ && service == GaiaConstants::kGaiaOAuth2LoginRefreshToken) { | 125 if (profile_ && service == GaiaConstants::kGaiaOAuth2LoginRefreshToken) { |
126 ProfileOAuth2TokenService* token_service = | 126 ProfileOAuth2TokenService* token_service = |
127 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); | 127 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
128 #if defined(ENABLE_MANAGED_USERS) | 128 #if defined(ENABLE_MANAGED_USERS) |
129 std::string account_id = profile_->IsManaged() ? | 129 std::string account_id = profile_->IsManaged() ? |
130 managed_users::kManagedUserPseudoEmail : | 130 managed_users::kManagedUserPseudoEmail : |
131 token_service->GetPrimaryAccountId(); | 131 token_service->GetPrimaryAccountId(); |
132 #else | 132 #else |
133 std::string account_id = token_service->GetPrimaryAccountId(); | 133 std::string account_id = token_service->GetPrimaryAccountId(); |
134 #endif | 134 #endif |
135 DCHECK(!account_id.empty()); | 135 DCHECK(!account_id.empty()); |
136 token_service->UpdateCredentials(account_id, auth_token); | 136 token_service->UpdateCredentials(account_id, auth_token); |
137 } | 137 } |
138 } | 138 } |
OLD | NEW |