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/chromeos/settings/device_oauth2_token_service.h" | 5 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 PrefService* local_state) | 213 PrefService* local_state) |
214 : refresh_token_is_valid_(false), | 214 : refresh_token_is_valid_(false), |
215 max_refresh_token_validation_retries_(3), | 215 max_refresh_token_validation_retries_(3), |
216 url_request_context_getter_(getter), | 216 url_request_context_getter_(getter), |
217 local_state_(local_state) { | 217 local_state_(local_state) { |
218 } | 218 } |
219 | 219 |
220 DeviceOAuth2TokenService::~DeviceOAuth2TokenService() { | 220 DeviceOAuth2TokenService::~DeviceOAuth2TokenService() { |
221 } | 221 } |
222 | 222 |
223 net::URLRequestContextGetter* DeviceOAuth2TokenService::GetRequestContext() { | |
224 return url_request_context_getter_.get(); | |
225 } | |
226 | |
227 scoped_ptr<OAuth2TokenService::Request> DeviceOAuth2TokenService::StartRequest( | 223 scoped_ptr<OAuth2TokenService::Request> DeviceOAuth2TokenService::StartRequest( |
228 const OAuth2TokenService::ScopeSet& scopes, | 224 const OAuth2TokenService::ScopeSet& scopes, |
229 OAuth2TokenService::Consumer* consumer) { | 225 OAuth2TokenService::Consumer* consumer) { |
230 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 226 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
231 | 227 |
232 if (refresh_token_is_valid_) { | 228 if (refresh_token_is_valid_) { |
233 return OAuth2TokenService::StartRequest(scopes, consumer).Pass(); | 229 return OAuth2TokenService::StartRequest(scopes, consumer).Pass(); |
234 } else { | 230 } else { |
235 scoped_ptr<ValidatingConsumer> validating_consumer( | 231 scoped_ptr<ValidatingConsumer> validating_consumer( |
236 new ValidatingConsumer(this, consumer)); | 232 new ValidatingConsumer(this, consumer)); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 } | 272 } |
277 | 273 |
278 std::string DeviceOAuth2TokenService::GetRobotAccountId() { | 274 std::string DeviceOAuth2TokenService::GetRobotAccountId() { |
279 policy::BrowserPolicyConnector* connector = | 275 policy::BrowserPolicyConnector* connector = |
280 g_browser_process->browser_policy_connector(); | 276 g_browser_process->browser_policy_connector(); |
281 if (connector) | 277 if (connector) |
282 return connector->GetDeviceCloudPolicyManager()->GetRobotAccountId(); | 278 return connector->GetDeviceCloudPolicyManager()->GetRobotAccountId(); |
283 return std::string(); | 279 return std::string(); |
284 } | 280 } |
285 | 281 |
| 282 net::URLRequestContextGetter* DeviceOAuth2TokenService::GetRequestContext() { |
| 283 return url_request_context_getter_.get(); |
| 284 } |
| 285 |
286 } // namespace chromeos | 286 } // namespace chromeos |
OLD | NEW |