| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ntp_snippets/remote/remote_suggestions_fetcher.h" | 5 #include "components/ntp_snippets/remote/remote_suggestions_fetcher.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 } | 398 } |
| 399 | 399 |
| 400 DLOG(ERROR) << "Unable to get token: " << error.ToString(); | 400 DLOG(ERROR) << "Unable to get token: " << error.ToString(); |
| 401 while (!pending_requests_.empty()) { | 401 while (!pending_requests_.empty()) { |
| 402 std::pair<JsonRequest::Builder, SnippetsAvailableCallback> | 402 std::pair<JsonRequest::Builder, SnippetsAvailableCallback> |
| 403 builder_and_callback = std::move(pending_requests_.front()); | 403 builder_and_callback = std::move(pending_requests_.front()); |
| 404 | 404 |
| 405 FetchFinished(OptionalFetchedCategories(), | 405 FetchFinished(OptionalFetchedCategories(), |
| 406 std::move(builder_and_callback.second), | 406 std::move(builder_and_callback.second), |
| 407 FetchResult::OAUTH_TOKEN_ERROR, | 407 FetchResult::OAUTH_TOKEN_ERROR, |
| 408 /*error_details=*/base::StringPrintf( | 408 /*error_details=*/ |
| 409 " (%s)", error.ToString().c_str())); | 409 base::StringPrintf(" (%s)", error.ToString().c_str())); |
| 410 pending_requests_.pop(); | 410 pending_requests_.pop(); |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 | 413 |
| 414 //////////////////////////////////////////////////////////////////////////////// | 414 //////////////////////////////////////////////////////////////////////////////// |
| 415 // OAuth2TokenService::Observer overrides | 415 // OAuth2TokenService::Observer overrides |
| 416 void RemoteSuggestionsFetcher::OnRefreshTokenAvailable( | 416 void RemoteSuggestionsFetcher::OnRefreshTokenAvailable( |
| 417 const std::string& account_id) { | 417 const std::string& account_id) { |
| 418 // Only react on tokens for the account the user has signed in with. | 418 // Only react on tokens for the account the user has signed in with. |
| 419 if (account_id != signin_manager_->GetAuthenticatedAccountId()) { | 419 if (account_id != signin_manager_->GetAuthenticatedAccountId()) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 categories->back().suggestions = std::move(suggestions); | 551 categories->back().suggestions = std::move(suggestions); |
| 552 } | 552 } |
| 553 return true; | 553 return true; |
| 554 } | 554 } |
| 555 } | 555 } |
| 556 NOTREACHED(); | 556 NOTREACHED(); |
| 557 return false; | 557 return false; |
| 558 } | 558 } |
| 559 | 559 |
| 560 } // namespace ntp_snippets | 560 } // namespace ntp_snippets |
| OLD | NEW |