Chromium Code Reviews| 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/ntp_snippets_fetcher.h" | 5 #include "components/ntp_snippets/remote/ntp_snippets_fetcher.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 674 std::string NTPSnippetsFetcher::RequestBuilder::BuildHeaders() const { | 674 std::string NTPSnippetsFetcher::RequestBuilder::BuildHeaders() const { |
| 675 net::HttpRequestHeaders headers; | 675 net::HttpRequestHeaders headers; |
| 676 headers.SetHeader("Content-Type", "application/json; charset=UTF-8"); | 676 headers.SetHeader("Content-Type", "application/json; charset=UTF-8"); |
| 677 if (!auth_header_.empty()) { | 677 if (!auth_header_.empty()) { |
| 678 headers.SetHeader("Authorization", auth_header_); | 678 headers.SetHeader("Authorization", auth_header_); |
| 679 } | 679 } |
| 680 // Add X-Client-Data header with experiment IDs from field trials. | 680 // Add X-Client-Data header with experiment IDs from field trials. |
| 681 variations::AppendVariationHeaders(url_, | 681 variations::AppendVariationHeaders(url_, |
| 682 false, // incognito | 682 false, // incognito |
| 683 false, // uma_enabled | 683 false, // uma_enabled |
| 684 false, // is_signed_in | |
|
Marc Treib
2016/12/09 12:34:31
Essentially the same comment that mathp had: Can y
Alexei Svitkine (slow)
2016/12/09 15:53:58
Done.
| |
| 684 &headers); | 685 &headers); |
| 685 return headers.ToString(); | 686 return headers.ToString(); |
| 686 } | 687 } |
| 687 | 688 |
| 688 std::string NTPSnippetsFetcher::RequestBuilder::BuildBody() const { | 689 std::string NTPSnippetsFetcher::RequestBuilder::BuildBody() const { |
| 689 auto request = base::MakeUnique<base::DictionaryValue>(); | 690 auto request = base::MakeUnique<base::DictionaryValue>(); |
| 690 std::string user_locale = PosixLocaleFromBCP47Language(params_.language_code); | 691 std::string user_locale = PosixLocaleFromBCP47Language(params_.language_code); |
| 691 switch (fetch_api_) { | 692 switch (fetch_api_) { |
| 692 case NTPSnippetsFetcher::CHROME_READER_API: { | 693 case NTPSnippetsFetcher::CHROME_READER_API: { |
| 693 auto content_params = base::MakeUnique<base::DictionaryValue>(); | 694 auto content_params = base::MakeUnique<base::DictionaryValue>(); |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1097 NOTREACHED(); | 1098 NOTREACHED(); |
| 1098 return false; | 1099 return false; |
| 1099 } | 1100 } |
| 1100 | 1101 |
| 1101 bool NTPSnippetsFetcher::NeedsAuthentication() const { | 1102 bool NTPSnippetsFetcher::NeedsAuthentication() const { |
| 1102 return (personalization_ == Personalization::kPersonal || | 1103 return (personalization_ == Personalization::kPersonal || |
| 1103 personalization_ == Personalization::kBoth); | 1104 personalization_ == Personalization::kBoth); |
| 1104 } | 1105 } |
| 1105 | 1106 |
| 1106 } // namespace ntp_snippets | 1107 } // namespace ntp_snippets |
| OLD | NEW |