| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/signin/oauth2_token_service.h" | 5 #include "chrome/browser/signin/oauth2_token_service.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 return error_state == GoogleServiceAuthError::CONNECTION_FAILED || | 248 return error_state == GoogleServiceAuthError::CONNECTION_FAILED || |
| 249 error_state == GoogleServiceAuthError::REQUEST_CANCELED || | 249 error_state == GoogleServiceAuthError::REQUEST_CANCELED || |
| 250 error_state == GoogleServiceAuthError::SERVICE_UNAVAILABLE; | 250 error_state == GoogleServiceAuthError::SERVICE_UNAVAILABLE; |
| 251 } | 251 } |
| 252 | 252 |
| 253 void OAuth2TokenService::Fetcher::InformWaitingRequests() { | 253 void OAuth2TokenService::Fetcher::InformWaitingRequests() { |
| 254 std::vector<base::WeakPtr<RequestImpl> >::const_iterator iter = | 254 std::vector<base::WeakPtr<RequestImpl> >::const_iterator iter = |
| 255 waiting_requests_.begin(); | 255 waiting_requests_.begin(); |
| 256 for (; iter != waiting_requests_.end(); ++iter) { | 256 for (; iter != waiting_requests_.end(); ++iter) { |
| 257 base::WeakPtr<RequestImpl> waiting_request = *iter; | 257 base::WeakPtr<RequestImpl> waiting_request = *iter; |
| 258 if (waiting_request) | 258 if (waiting_request.get()) |
| 259 waiting_request->InformConsumer(error_, access_token_, expiration_date_); | 259 waiting_request->InformConsumer(error_, access_token_, expiration_date_); |
| 260 } | 260 } |
| 261 waiting_requests_.clear(); | 261 waiting_requests_.clear(); |
| 262 } | 262 } |
| 263 | 263 |
| 264 void OAuth2TokenService::Fetcher::AddWaitingRequest( | 264 void OAuth2TokenService::Fetcher::AddWaitingRequest( |
| 265 base::WeakPtr<OAuth2TokenService::RequestImpl> waiting_request) { | 265 base::WeakPtr<OAuth2TokenService::RequestImpl> waiting_request) { |
| 266 waiting_requests_.push_back(waiting_request); | 266 waiting_requests_.push_back(waiting_request); |
| 267 } | 267 } |
| 268 | 268 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } | 456 } |
| 457 | 457 |
| 458 void OAuth2TokenService::ClearCache() { | 458 void OAuth2TokenService::ClearCache() { |
| 459 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 459 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 460 token_cache_.clear(); | 460 token_cache_.clear(); |
| 461 } | 461 } |
| 462 | 462 |
| 463 int OAuth2TokenService::cache_size_for_testing() const { | 463 int OAuth2TokenService::cache_size_for_testing() const { |
| 464 return token_cache_.size(); | 464 return token_cache_.size(); |
| 465 } | 465 } |
| OLD | NEW |