Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: components/ntp_snippets/remote/ntp_snippets_fetcher.cc

Issue 2569973002: Revert of Restrict transmission of external exp ids to signed in users. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 /*default_value=*/false); 671 /*default_value=*/false);
672 } 672 }
673 673
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 // Note: It's fine to pass in |is_signed_in| false, which does not affect
682 // transmission of experiment ids coming from the variations server.
683 bool is_signed_in = false;
684 variations::AppendVariationHeaders(url_, 681 variations::AppendVariationHeaders(url_,
685 false, // incognito 682 false, // incognito
686 false, // uma_enabled 683 false, // uma_enabled
687 is_signed_in, &headers); 684 &headers);
688 return headers.ToString(); 685 return headers.ToString();
689 } 686 }
690 687
691 std::string NTPSnippetsFetcher::RequestBuilder::BuildBody() const { 688 std::string NTPSnippetsFetcher::RequestBuilder::BuildBody() const {
692 auto request = base::MakeUnique<base::DictionaryValue>(); 689 auto request = base::MakeUnique<base::DictionaryValue>();
693 std::string user_locale = PosixLocaleFromBCP47Language(params_.language_code); 690 std::string user_locale = PosixLocaleFromBCP47Language(params_.language_code);
694 switch (fetch_api_) { 691 switch (fetch_api_) {
695 case NTPSnippetsFetcher::CHROME_READER_API: { 692 case NTPSnippetsFetcher::CHROME_READER_API: {
696 auto content_params = base::MakeUnique<base::DictionaryValue>(); 693 auto content_params = base::MakeUnique<base::DictionaryValue>();
697 content_params->SetBoolean("only_return_personalized_results", 694 content_params->SetBoolean("only_return_personalized_results",
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 NOTREACHED(); 1097 NOTREACHED();
1101 return false; 1098 return false;
1102 } 1099 }
1103 1100
1104 bool NTPSnippetsFetcher::NeedsAuthentication() const { 1101 bool NTPSnippetsFetcher::NeedsAuthentication() const {
1105 return (personalization_ == Personalization::kPersonal || 1102 return (personalization_ == Personalization::kPersonal ||
1106 personalization_ == Personalization::kBoth); 1103 personalization_ == Personalization::kBoth);
1107 } 1104 }
1108 1105
1109 } // namespace ntp_snippets 1106 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/feedback/feedback_uploader_chrome.cc ('k') | components/omnibox/browser/search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698