Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: components/signin/core/browser/gaia_cookie_manager_service.cc

Issue 1448983002: Actually mark list accounts as stale while they're being fetched. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/signin/core/browser/gaia_cookie_manager_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 uber_token_fetcher_.reset(); 441 uber_token_fetcher_.reset();
442 requests_.clear(); 442 requests_.clear();
443 fetcher_timer_.Stop(); 443 fetcher_timer_.Stop();
444 } 444 }
445 445
446 void GaiaCookieManagerService::OnCookieChanged( 446 void GaiaCookieManagerService::OnCookieChanged(
447 const net::CanonicalCookie& cookie, 447 const net::CanonicalCookie& cookie,
448 bool removed) { 448 bool removed) {
449 DCHECK_EQ(kGaiaCookieName, cookie.Name()); 449 DCHECK_EQ(kGaiaCookieName, cookie.Name());
450 DCHECK_EQ(GaiaUrls::GetInstance()->google_url().host(), cookie.Domain()); 450 DCHECK_EQ(GaiaUrls::GetInstance()->google_url().host(), cookie.Domain());
451 list_accounts_stale_ = true;
451 // Ignore changes to the cookie while requests are pending. These changes 452 // Ignore changes to the cookie while requests are pending. These changes
452 // are caused by the service itself as it adds accounts. A side effects is 453 // are caused by the service itself as it adds accounts. A side effects is
453 // that any changes to the gaia cookie outside of this class, while requests 454 // that any changes to the gaia cookie outside of this class, while requests
454 // are pending, will be lost. However, trying to process these changes could 455 // are pending, will be lost. However, trying to process these changes could
455 // cause an endless loop (see crbug.com/516070). 456 // cause an endless loop (see crbug.com/516070).
456 if (requests_.empty()) { 457 if (requests_.empty()) {
457 requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest()); 458 requests_.push_back(GaiaCookieRequest::CreateListAccountsRequest());
458 fetcher_retries_ = 0; 459 fetcher_retries_ = 0;
459 signin_client_->DelayNetworkCall( 460 signin_client_->DelayNetworkCall(
460 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, 461 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts,
461 base::Unretained(this))); 462 base::Unretained(this)));
462 } else {
463 list_accounts_stale_ = true;
464 } 463 }
465 } 464 }
466 465
467 void GaiaCookieManagerService::SignalComplete( 466 void GaiaCookieManagerService::SignalComplete(
468 const std::string& account_id, 467 const std::string& account_id,
469 const GoogleServiceAuthError& error) { 468 const GoogleServiceAuthError& error) {
470 // Its possible for the observer to delete |this| object. Don't access 469 // Its possible for the observer to delete |this| object. Don't access
471 // access any members after this calling the observer. This method should 470 // access any members after this calling the observer. This method should
472 // be the last call in any other method. 471 // be the last call in any other method.
473 FOR_EACH_OBSERVER(Observer, observer_list_, 472 FOR_EACH_OBSERVER(Observer, observer_list_,
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 break; 704 break;
706 case GaiaCookieRequestType::LIST_ACCOUNTS: 705 case GaiaCookieRequestType::LIST_ACCOUNTS:
707 uber_token_fetcher_.reset(); 706 uber_token_fetcher_.reset();
708 signin_client_->DelayNetworkCall( 707 signin_client_->DelayNetworkCall(
709 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts, 708 base::Bind(&GaiaCookieManagerService::StartFetchingListAccounts,
710 base::Unretained(this))); 709 base::Unretained(this)));
711 break; 710 break;
712 }; 711 };
713 } 712 }
714 } 713 }
OLDNEW
« no previous file with comments | « no previous file | components/signin/core/browser/gaia_cookie_manager_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698