Chromium Code Reviews| 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/gaia_cookie_manager_service.h" | 5 #include "components/signin/core/browser/gaia_cookie_manager_service.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 315 return; | 315 return; |
| 316 } | 316 } |
| 317 | 317 |
| 318 DCHECK(!account_id.empty()); | 318 DCHECK(!account_id.empty()); |
| 319 VLOG(1) << "GaiaCookieManagerService::AddAccountToCookie: " << account_id; | 319 VLOG(1) << "GaiaCookieManagerService::AddAccountToCookie: " << account_id; |
| 320 requests_.push_back(GaiaCookieRequest::CreateAddAccountRequest(account_id)); | 320 requests_.push_back(GaiaCookieRequest::CreateAddAccountRequest(account_id)); |
| 321 if (requests_.size() == 1) | 321 if (requests_.size() == 1) |
| 322 StartFetchingUbertoken(); | 322 StartFetchingUbertoken(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 void GaiaCookieManagerService::AddAccountToCookieWithToken( | |
| 326 const std::string& account_id, const std::string& access_token) { | |
|
Roger Tawa OOO till Jul 10th
2015/05/14 20:51:35
nit: two lines?
Mike Lerman
2015/05/15 20:49:47
Done.
| |
| 327 if (!signin_client_->AreSigninCookiesAllowed()) { | |
| 328 SignalComplete(account_id, | |
| 329 GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED)); | |
| 330 return; | |
| 331 } | |
| 332 | |
| 333 DCHECK(!account_id.empty()); | |
| 334 DCHECK(!access_token.empty()); | |
| 335 VLOG(1) << "GaiaCookieManagerService::AddAccountToCookie: " << account_id; | |
|
Roger Tawa OOO till Jul 10th
2015/05/14 20:51:35
nit: wrong vlog function name.
Mike Lerman
2015/05/15 20:49:47
Done.
| |
| 336 requests_.push_back(GaiaCookieRequest::CreateAddAccountRequest(account_id)); | |
| 337 if (requests_.size() == 1) | |
| 338 StartFetchingUbertokenWithAccessToken(access_token); | |
| 339 } | |
| 340 | |
| 325 bool GaiaCookieManagerService::ListAccounts( | 341 bool GaiaCookieManagerService::ListAccounts( |
| 326 std::vector<std::pair<std::string,bool> >* accounts) { | 342 std::vector<std::pair<std::string,bool> >* accounts) { |
| 327 DCHECK(accounts); | 343 DCHECK(accounts); |
| 328 accounts->clear(); | 344 accounts->clear(); |
| 329 | 345 |
| 330 // There is a fetch currently executing (the results being provided in the | 346 // There is a fetch currently executing (the results being provided in the |
| 331 // parameter don't align with the fetches that have been started), or the list | 347 // parameter don't align with the fetches that have been started), or the list |
| 332 // of accounts haven't been fetched even once. | 348 // of accounts haven't been fetched even once. |
| 333 if (!requests_.empty()) | 349 if (!requests_.empty()) |
| 334 return false; | 350 return false; |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 | 584 |
| 569 void GaiaCookieManagerService::StartFetchingUbertoken() { | 585 void GaiaCookieManagerService::StartFetchingUbertoken() { |
| 570 VLOG(1) << "GaiaCookieManagerService::StartFetching account_id=" | 586 VLOG(1) << "GaiaCookieManagerService::StartFetching account_id=" |
| 571 << requests_.front().account_id(); | 587 << requests_.front().account_id(); |
| 572 uber_token_fetcher_.reset( | 588 uber_token_fetcher_.reset( |
| 573 new UbertokenFetcher(token_service_, this, source_, | 589 new UbertokenFetcher(token_service_, this, source_, |
| 574 signin_client_->GetURLRequestContext())); | 590 signin_client_->GetURLRequestContext())); |
| 575 uber_token_fetcher_->StartFetchingToken(requests_.front().account_id()); | 591 uber_token_fetcher_->StartFetchingToken(requests_.front().account_id()); |
| 576 } | 592 } |
| 577 | 593 |
| 594 void GaiaCookieManagerService::StartFetchingUbertokenWithAccessToken( | |
| 595 const std::string& access_token) { | |
| 596 VLOG(1) << "GaiaCookieManagerService::StartFetching account_id=" | |
| 597 << requests_.front().account_id(); | |
|
Roger Tawa OOO till Jul 10th
2015/05/14 20:51:35
nit: wrong vlog function name.
Mike Lerman
2015/05/15 20:49:47
Done.
| |
| 598 DCHECK(!access_token.empty()); | |
| 599 uber_token_fetcher_.reset( | |
| 600 new UbertokenFetcher(token_service_, this, source_, | |
| 601 signin_client_->GetURLRequestContext())); | |
| 602 uber_token_fetcher_->StartFetchingTokenWithAccessToken( | |
| 603 requests_.front().account_id(), access_token); | |
| 604 } | |
| 605 | |
| 578 void GaiaCookieManagerService::StartFetchingMergeSession() { | 606 void GaiaCookieManagerService::StartFetchingMergeSession() { |
| 579 DCHECK(!uber_token_.empty()); | 607 DCHECK(!uber_token_.empty()); |
| 580 gaia_auth_fetcher_.reset( | 608 gaia_auth_fetcher_.reset( |
| 581 new GaiaAuthFetcher(this, source_, | 609 new GaiaAuthFetcher(this, source_, |
| 582 signin_client_->GetURLRequestContext())); | 610 signin_client_->GetURLRequestContext())); |
| 583 | 611 |
| 584 gaia_auth_fetcher_->StartMergeSession(uber_token_, | 612 gaia_auth_fetcher_->StartMergeSession(uber_token_, |
| 585 external_cc_result_fetcher_.GetExternalCcResult()); | 613 external_cc_result_fetcher_.GetExternalCcResult()); |
| 586 } | 614 } |
| 587 | 615 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 640 case GaiaCookieRequestType::LOG_OUT: | 668 case GaiaCookieRequestType::LOG_OUT: |
| 641 StartLogOutUrlFetch(); | 669 StartLogOutUrlFetch(); |
| 642 break; | 670 break; |
| 643 case GaiaCookieRequestType::LIST_ACCOUNTS: | 671 case GaiaCookieRequestType::LIST_ACCOUNTS: |
| 644 uber_token_fetcher_.reset(); | 672 uber_token_fetcher_.reset(); |
| 645 StartFetchingListAccounts(); | 673 StartFetchingListAccounts(); |
| 646 break; | 674 break; |
| 647 }; | 675 }; |
| 648 } | 676 } |
| 649 } | 677 } |
| OLD | NEW |