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 "google_apis/gaia/oauth2_token_service.h" | 5 #include "google_apis/gaia/oauth2_token_service.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
16 #include "base/profiler/scoped_tracker.h" | 16 #include "base/profiler/scoped_tracker.h" |
17 #include "base/rand_util.h" | 17 #include "base/rand_util.h" |
18 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 OnFetchAccessTokenComplete( | 500 OnFetchAccessTokenComplete( |
501 account_id, consumer->id(), scopes, error, | 501 account_id, consumer->id(), scopes, error, |
502 base::Time())); | 502 base::Time())); |
503 | 503 |
504 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 504 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( |
505 &RequestImpl::InformConsumer, | 505 &RequestImpl::InformConsumer, |
506 request->AsWeakPtr(), | 506 request->AsWeakPtr(), |
507 error, | 507 error, |
508 std::string(), | 508 std::string(), |
509 base::Time())); | 509 base::Time())); |
510 return request.Pass(); | 510 return std::move(request); |
511 } | 511 } |
512 | 512 |
513 RequestParameters request_parameters(client_id, | 513 RequestParameters request_parameters(client_id, |
514 account_id, | 514 account_id, |
515 scopes); | 515 scopes); |
516 if (HasCacheEntry(request_parameters)) { | 516 if (HasCacheEntry(request_parameters)) { |
517 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 | 517 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 |
518 // is fixed. | 518 // is fixed. |
519 tracked_objects::ScopedTracker tracking_profile3( | 519 tracked_objects::ScopedTracker tracking_profile3( |
520 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 520 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
521 "422460 OAuth2TokenService::StartRequestForClientWithContext 3")); | 521 "422460 OAuth2TokenService::StartRequestForClientWithContext 3")); |
522 | 522 |
523 StartCacheLookupRequest(request.get(), request_parameters, consumer); | 523 StartCacheLookupRequest(request.get(), request_parameters, consumer); |
524 } else { | 524 } else { |
525 FetchOAuth2Token(request.get(), | 525 FetchOAuth2Token(request.get(), |
526 account_id, | 526 account_id, |
527 getter, | 527 getter, |
528 client_id, | 528 client_id, |
529 client_secret, | 529 client_secret, |
530 scopes); | 530 scopes); |
531 } | 531 } |
532 return request.Pass(); | 532 return std::move(request); |
533 } | 533 } |
534 | 534 |
535 void OAuth2TokenService::FetchOAuth2Token(RequestImpl* request, | 535 void OAuth2TokenService::FetchOAuth2Token(RequestImpl* request, |
536 const std::string& account_id, | 536 const std::string& account_id, |
537 net::URLRequestContextGetter* getter, | 537 net::URLRequestContextGetter* getter, |
538 const std::string& client_id, | 538 const std::string& client_id, |
539 const std::string& client_secret, | 539 const std::string& client_secret, |
540 const ScopeSet& scopes) { | 540 const ScopeSet& scopes) { |
541 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is | 541 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is |
542 // fixed. | 542 // fixed. |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 const std::string& account_id, | 825 const std::string& account_id, |
826 const ScopeSet& scopes) const { | 826 const ScopeSet& scopes) const { |
827 PendingFetcherMap::const_iterator iter = pending_fetchers_.find( | 827 PendingFetcherMap::const_iterator iter = pending_fetchers_.find( |
828 OAuth2TokenService::RequestParameters( | 828 OAuth2TokenService::RequestParameters( |
829 client_id, | 829 client_id, |
830 account_id, | 830 account_id, |
831 scopes)); | 831 scopes)); |
832 return iter == pending_fetchers_.end() ? | 832 return iter == pending_fetchers_.end() ? |
833 0 : iter->second->GetWaitingRequestCount(); | 833 0 : iter->second->GetWaitingRequestCount(); |
834 } | 834 } |
OLD | NEW |