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