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 "chrome/browser/ui/webui/snippets_internals_message_handler.h" | 5 #include "chrome/browser/ui/webui/snippets_internals_message_handler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 SendString("hosts-status", std::string()); | 229 SendString("hosts-status", std::string()); |
230 | 230 |
231 std::string hosts_string; | 231 std::string hosts_string; |
232 args->GetString(0, &hosts_string); | 232 args->GetString(0, &hosts_string); |
233 | 233 |
234 std::vector<std::string> hosts_vector = base::SplitString( | 234 std::vector<std::string> hosts_vector = base::SplitString( |
235 hosts_string, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 235 hosts_string, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
236 std::set<std::string> hosts(hosts_vector.begin(), hosts_vector.end()); | 236 std::set<std::string> hosts(hosts_vector.begin(), hosts_vector.end()); |
237 | 237 |
238 ntp_snippets_service_->FetchSnippetsFromHosts(hosts); | 238 ntp_snippets_service_->FetchSnippetsFromHosts(hosts, /*force_requests=*/true); |
239 } | 239 } |
240 | 240 |
241 void SnippetsInternalsMessageHandler::HandleClearCachedSuggestions( | 241 void SnippetsInternalsMessageHandler::HandleClearCachedSuggestions( |
242 const base::ListValue* args) { | 242 const base::ListValue* args) { |
243 DCHECK_EQ(0u, args->GetSize()); | 243 DCHECK_EQ(0u, args->GetSize()); |
244 | 244 |
245 content_suggestions_service_->ClearCachedSuggestionsForDebugging(); | 245 content_suggestions_service_->ClearCachedSuggestionsForDebugging(); |
246 } | 246 } |
247 | 247 |
248 void SnippetsInternalsMessageHandler::HandleClearDiscardedSuggestions( | 248 void SnippetsInternalsMessageHandler::HandleClearDiscardedSuggestions( |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } | 374 } |
375 | 375 |
376 void SnippetsInternalsMessageHandler::SendString(const std::string& name, | 376 void SnippetsInternalsMessageHandler::SendString(const std::string& name, |
377 const std::string& value) { | 377 const std::string& value) { |
378 base::StringValue string_name(name); | 378 base::StringValue string_name(name); |
379 base::StringValue string_value(value); | 379 base::StringValue string_value(value); |
380 | 380 |
381 web_ui()->CallJavascriptFunctionUnsafe( | 381 web_ui()->CallJavascriptFunctionUnsafe( |
382 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); | 382 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); |
383 } | 383 } |
OLD | NEW |