| Index: components/ntp_snippets/ntp_snippets_fetcher.cc
|
| diff --git a/components/ntp_snippets/ntp_snippets_fetcher.cc b/components/ntp_snippets/ntp_snippets_fetcher.cc
|
| index f7c82fab41c6cf74a37108c0f03ca1f4dc24909c..00e2e871e67a8c0cd8cbca1250bf70001254b7e4 100644
|
| --- a/components/ntp_snippets/ntp_snippets_fetcher.cc
|
| +++ b/components/ntp_snippets/ntp_snippets_fetcher.cc
|
| @@ -57,6 +57,7 @@ NTPSnippetsFetcher::NTPSnippetsFetcher(
|
| url_request_context_getter_(url_request_context_getter),
|
| signin_manager_(signin_manager),
|
| token_service_(token_service),
|
| + waiting_for_refresh_token_(false),
|
| weak_ptr_factory_(this) {}
|
|
|
| NTPSnippetsFetcher::~NTPSnippetsFetcher() {}
|
| @@ -89,9 +90,10 @@ void NTPSnippetsFetcher::OnFileExistsCheckDone(bool exists) {
|
| void NTPSnippetsFetcher::StartFetch() {
|
| if (signin_manager_->IsAuthenticated()) {
|
| StartTokenRequest();
|
| - } else {
|
| + } else if (!waiting_for_refresh_token_) {
|
| // Wait until we get a refresh token.
|
| token_service_->AddObserver(this);
|
| + waiting_for_refresh_token_ = true;
|
| }
|
| }
|
|
|
| @@ -142,6 +144,7 @@ void NTPSnippetsFetcher::OnGetTokenFailure(
|
| void NTPSnippetsFetcher::OnRefreshTokenAvailable(
|
| const std::string& account_id) {
|
| token_service_->RemoveObserver(this);
|
| + waiting_for_refresh_token_ = false;
|
| StartTokenRequest();
|
| }
|
|
|
|
|