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/ntp_snippets_fetcher.h" | 5 #include "components/ntp_snippets/ntp_snippets_fetcher.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 GURL url(base::StringPrintf(kSnippetsServerNonAuthorizedFormat, | 447 GURL url(base::StringPrintf(kSnippetsServerNonAuthorizedFormat, |
448 fetch_url_.spec().c_str(), key.c_str())); | 448 fetch_url_.spec().c_str(), key.c_str())); |
449 | 449 |
450 RequestParams params; | 450 RequestParams params; |
451 params.fetch_api = fetch_api_; | 451 params.fetch_api = fetch_api_; |
452 params.host_restricts = | 452 params.host_restricts = |
453 UsesHostRestrictions() ? hosts_ : std::set<std::string>(); | 453 UsesHostRestrictions() ? hosts_ : std::set<std::string>(); |
454 params.excluded_ids = excluded_ids_; | 454 params.excluded_ids = excluded_ids_; |
455 params.count_to_fetch = count_to_fetch_; | 455 params.count_to_fetch = count_to_fetch_; |
456 params.interactive_request = interactive_request_; | 456 params.interactive_request = interactive_request_; |
| 457 params.user_locale = locale_; |
457 FetchSnippetsImpl(url, std::string(), params.BuildRequest()); | 458 FetchSnippetsImpl(url, std::string(), params.BuildRequest()); |
458 } | 459 } |
459 | 460 |
460 void NTPSnippetsFetcher::FetchSnippetsAuthenticated( | 461 void NTPSnippetsFetcher::FetchSnippetsAuthenticated( |
461 const std::string& account_id, | 462 const std::string& account_id, |
462 const std::string& oauth_access_token) { | 463 const std::string& oauth_access_token) { |
463 RequestParams params; | 464 RequestParams params; |
464 params.fetch_api = fetch_api_; | 465 params.fetch_api = fetch_api_; |
465 params.obfuscated_gaia_id = account_id; | 466 params.obfuscated_gaia_id = account_id; |
466 params.only_return_personalized_results = | 467 params.only_return_personalized_results = |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Snippets.FetchResult", | 666 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Snippets.FetchResult", |
666 static_cast<int>(result), | 667 static_cast<int>(result), |
667 static_cast<int>(FetchResult::RESULT_MAX)); | 668 static_cast<int>(FetchResult::RESULT_MAX)); |
668 | 669 |
669 DVLOG(1) << "Fetch finished: " << last_status_; | 670 DVLOG(1) << "Fetch finished: " << last_status_; |
670 if (!snippets_available_callback_.is_null()) | 671 if (!snippets_available_callback_.is_null()) |
671 snippets_available_callback_.Run(std::move(snippets)); | 672 snippets_available_callback_.Run(std::move(snippets)); |
672 } | 673 } |
673 | 674 |
674 } // namespace ntp_snippets | 675 } // namespace ntp_snippets |
OLD | NEW |