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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 } | 385 } |
386 | 386 |
387 DLOG(ERROR) << "Unable to get token: " << error.ToString(); | 387 DLOG(ERROR) << "Unable to get token: " << error.ToString(); |
388 while (!pending_requests_.empty()) { | 388 while (!pending_requests_.empty()) { |
389 std::pair<JsonRequest::Builder, SnippetsAvailableCallback> | 389 std::pair<JsonRequest::Builder, SnippetsAvailableCallback> |
390 builder_and_callback = std::move(pending_requests_.front()); | 390 builder_and_callback = std::move(pending_requests_.front()); |
391 | 391 |
392 FetchFinished(OptionalFetchedCategories(), | 392 FetchFinished(OptionalFetchedCategories(), |
393 std::move(builder_and_callback.second), | 393 std::move(builder_and_callback.second), |
394 FetchResult::OAUTH_TOKEN_ERROR, | 394 FetchResult::OAUTH_TOKEN_ERROR, |
395 /*error_details=*/base::StringPrintf( | 395 /*error_details=*/ |
396 " (%s)", error.ToString().c_str())); | 396 base::StringPrintf(" (%s)", error.ToString().c_str())); |
397 pending_requests_.pop(); | 397 pending_requests_.pop(); |
398 } | 398 } |
399 } | 399 } |
400 | 400 |
401 //////////////////////////////////////////////////////////////////////////////// | 401 //////////////////////////////////////////////////////////////////////////////// |
402 // OAuth2TokenService::Observer overrides | 402 // OAuth2TokenService::Observer overrides |
403 void RemoteSuggestionsFetcher::OnRefreshTokenAvailable( | 403 void RemoteSuggestionsFetcher::OnRefreshTokenAvailable( |
404 const std::string& account_id) { | 404 const std::string& account_id) { |
405 // Only react on tokens for the account the user has signed in with. | 405 // Only react on tokens for the account the user has signed in with. |
406 if (account_id != signin_manager_->GetAuthenticatedAccountId()) { | 406 if (account_id != signin_manager_->GetAuthenticatedAccountId()) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 category, BuildRemoteCategoryInfo(base::UTF8ToUTF16(utf8_title), | 519 category, BuildRemoteCategoryInfo(base::UTF8ToUTF16(utf8_title), |
520 allow_fetching_more_results))); | 520 allow_fetching_more_results))); |
521 } | 521 } |
522 categories->back().suggestions = std::move(suggestions); | 522 categories->back().suggestions = std::move(suggestions); |
523 } | 523 } |
524 | 524 |
525 return true; | 525 return true; |
526 } | 526 } |
527 | 527 |
528 } // namespace ntp_snippets | 528 } // namespace ntp_snippets |
OLD | NEW |