| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 NTPSnippetsFetcher::RequestParams::~RequestParams() = default; | 253 NTPSnippetsFetcher::RequestParams::~RequestParams() = default; |
| 254 | 254 |
| 255 std::string NTPSnippetsFetcher::RequestParams::BuildRequest() { | 255 std::string NTPSnippetsFetcher::RequestParams::BuildRequest() { |
| 256 auto request = base::MakeUnique<base::DictionaryValue>(); | 256 auto request = base::MakeUnique<base::DictionaryValue>(); |
| 257 if (fetch_api == CHROME_READER_API) { | 257 if (fetch_api == CHROME_READER_API) { |
| 258 auto content_params = base::MakeUnique<base::DictionaryValue>(); | 258 auto content_params = base::MakeUnique<base::DictionaryValue>(); |
| 259 content_params->SetBoolean("only_return_personalized_results", | 259 content_params->SetBoolean("only_return_personalized_results", |
| 260 only_return_personalized_results); | 260 only_return_personalized_results); |
| 261 | 261 |
| 262 auto content_restricts = base::MakeUnique<base::ListValue>(); | 262 auto content_restricts = base::MakeUnique<base::ListValue>(); |
| 263 for (const auto& metadata : {"TITLE", "SNIPPET", "THUMBNAIL"}) { | 263 for (auto* metadata : {"TITLE", "SNIPPET", "THUMBNAIL"}) { |
| 264 auto entry = base::MakeUnique<base::DictionaryValue>(); | 264 auto entry = base::MakeUnique<base::DictionaryValue>(); |
| 265 entry->SetString("type", "METADATA"); | 265 entry->SetString("type", "METADATA"); |
| 266 entry->SetString("value", metadata); | 266 entry->SetString("value", metadata); |
| 267 content_restricts->Append(std::move(entry)); | 267 content_restricts->Append(std::move(entry)); |
| 268 } | 268 } |
| 269 | 269 |
| 270 auto content_selectors = base::MakeUnique<base::ListValue>(); | 270 auto content_selectors = base::MakeUnique<base::ListValue>(); |
| 271 for (const auto& host : host_restricts) { | 271 for (const auto& host : host_restricts) { |
| 272 auto entry = base::MakeUnique<base::DictionaryValue>(); | 272 auto entry = base::MakeUnique<base::DictionaryValue>(); |
| 273 entry->SetString("type", "HOST_RESTRICT"); | 273 entry->SetString("type", "HOST_RESTRICT"); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 tick_clock_->NowTicks() - fetch_start_time_); | 513 tick_clock_->NowTicks() - fetch_start_time_); |
| 514 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Snippets.FetchResult", | 514 UMA_HISTOGRAM_ENUMERATION("NewTabPage.Snippets.FetchResult", |
| 515 static_cast<int>(result), | 515 static_cast<int>(result), |
| 516 static_cast<int>(FetchResult::RESULT_MAX)); | 516 static_cast<int>(FetchResult::RESULT_MAX)); |
| 517 | 517 |
| 518 if (!snippets_available_callback_.is_null()) | 518 if (!snippets_available_callback_.is_null()) |
| 519 snippets_available_callback_.Run(std::move(snippets)); | 519 snippets_available_callback_.Run(std::move(snippets)); |
| 520 } | 520 } |
| 521 | 521 |
| 522 } // namespace ntp_snippets | 522 } // namespace ntp_snippets |
| OLD | NEW |