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_json_request.h" | 5 #include "components/ntp_snippets/remote/ntp_snippets_json_request.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 return *this; | 349 return *this; |
350 } | 350 } |
351 | 351 |
352 std::string NTPSnippetsJsonRequest::Builder::BuildHeaders() const { | 352 std::string NTPSnippetsJsonRequest::Builder::BuildHeaders() const { |
353 net::HttpRequestHeaders headers; | 353 net::HttpRequestHeaders headers; |
354 headers.SetHeader("Content-Type", "application/json; charset=UTF-8"); | 354 headers.SetHeader("Content-Type", "application/json; charset=UTF-8"); |
355 if (!auth_header_.empty()) { | 355 if (!auth_header_.empty()) { |
356 headers.SetHeader("Authorization", auth_header_); | 356 headers.SetHeader("Authorization", auth_header_); |
357 } | 357 } |
358 // Add X-Client-Data header with experiment IDs from field trials. | 358 // Add X-Client-Data header with experiment IDs from field trials. |
359 // Note: It's fine to pass in |is_signed_in| false, which does not affect | 359 // Note: It's OK to pass |is_signed_in| false if it's unknown, as it does |
360 // transmission of experiment ids coming from the variations server. | 360 // not affect transmission of experiments coming from the variations server. |
361 bool is_signed_in = false; | 361 bool is_signed_in = false; |
362 variations::AppendVariationHeaders(url_, | 362 variations::AppendVariationHeaders(url_, |
363 false, // incognito | 363 false, // incognito |
364 false, // uma_enabled | 364 false, // uma_enabled |
365 is_signed_in, &headers); | 365 is_signed_in, &headers); |
366 return headers.ToString(); | 366 return headers.ToString(); |
367 } | 367 } |
368 | 368 |
369 std::string NTPSnippetsJsonRequest::Builder::BuildBody() const { | 369 std::string NTPSnippetsJsonRequest::Builder::BuildBody() const { |
370 auto request = base::MakeUnique<base::DictionaryValue>(); | 370 auto request = base::MakeUnique<base::DictionaryValue>(); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 "NewTabPage.Languages.UILanguageRatioInTwoTopLanguages", | 515 "NewTabPage.Languages.UILanguageRatioInTwoTopLanguages", |
516 ratio_ui_in_both_languages * 100); | 516 ratio_ui_in_both_languages * 100); |
517 break; | 517 break; |
518 } | 518 } |
519 } | 519 } |
520 } | 520 } |
521 | 521 |
522 } // namespace internal | 522 } // namespace internal |
523 | 523 |
524 } // namespace ntp_snippets | 524 } // namespace ntp_snippets |
OLD | NEW |