| 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/json_request.h" | 5 #include "components/ntp_snippets/remote/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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 std::unique_ptr<net::URLFetcher> JsonRequest::Builder::BuildURLFetcher( | 432 std::unique_ptr<net::URLFetcher> JsonRequest::Builder::BuildURLFetcher( |
| 433 net::URLFetcherDelegate* delegate, | 433 net::URLFetcherDelegate* delegate, |
| 434 const std::string& headers, | 434 const std::string& headers, |
| 435 const std::string& body) const { | 435 const std::string& body) const { |
| 436 std::unique_ptr<net::URLFetcher> url_fetcher = | 436 std::unique_ptr<net::URLFetcher> url_fetcher = |
| 437 net::URLFetcher::Create(url_, net::URLFetcher::POST, delegate); | 437 net::URLFetcher::Create(url_, net::URLFetcher::POST, delegate); |
| 438 url_fetcher->SetRequestContext(url_request_context_getter_.get()); | 438 url_fetcher->SetRequestContext(url_request_context_getter_.get()); |
| 439 url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 439 url_fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 440 net::LOAD_DO_NOT_SAVE_COOKIES); | 440 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 441 data_use_measurement::DataUseUserData::AttachToFetcher( | 441 data_use_measurement::DataUseUserData::AttachToFetcher( |
| 442 url_fetcher.get(), data_use_measurement::DataUseUserData::NTP_SNIPPETS); | 442 url_fetcher.get(), |
| 443 data_use_measurement::DataUseUserData::NTP_SNIPPETS_SUGGESTIONS); |
| 443 | 444 |
| 444 url_fetcher->SetExtraRequestHeaders(headers); | 445 url_fetcher->SetExtraRequestHeaders(headers); |
| 445 url_fetcher->SetUploadData("application/json", body); | 446 url_fetcher->SetUploadData("application/json", body); |
| 446 | 447 |
| 447 // Fetchers are sometimes cancelled because a network change was detected. | 448 // Fetchers are sometimes cancelled because a network change was detected. |
| 448 url_fetcher->SetAutomaticallyRetryOnNetworkChanges(3); | 449 url_fetcher->SetAutomaticallyRetryOnNetworkChanges(3); |
| 449 url_fetcher->SetMaxRetriesOn5xx( | 450 url_fetcher->SetMaxRetriesOn5xx( |
| 450 Get5xxRetryCount(params_.interactive_request)); | 451 Get5xxRetryCount(params_.interactive_request)); |
| 451 return url_fetcher; | 452 return url_fetcher; |
| 452 } | 453 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 483 "NewTabPage.Languages.UILanguageRatioInTwoTopLanguages", | 484 "NewTabPage.Languages.UILanguageRatioInTwoTopLanguages", |
| 484 ratio_ui_in_both_languages * 100); | 485 ratio_ui_in_both_languages * 100); |
| 485 break; | 486 break; |
| 486 } | 487 } |
| 487 } | 488 } |
| 488 } | 489 } |
| 489 | 490 |
| 490 } // namespace internal | 491 } // namespace internal |
| 491 | 492 |
| 492 } // namespace ntp_snippets | 493 } // namespace ntp_snippets |
| OLD | NEW |