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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 DCHECK_EQ(0u, args->GetSize()); | 107 DCHECK_EQ(0u, args->GetSize()); |
108 | 108 |
109 dom_loaded_ = true; | 109 dom_loaded_ = true; |
110 | 110 |
111 SendInitialData(); | 111 SendInitialData(); |
112 } | 112 } |
113 | 113 |
114 void SnippetsInternalsMessageHandler::HandleClear(const base::ListValue* args) { | 114 void SnippetsInternalsMessageHandler::HandleClear(const base::ListValue* args) { |
115 DCHECK_EQ(0u, args->GetSize()); | 115 DCHECK_EQ(0u, args->GetSize()); |
116 | 116 |
117 ntp_snippets_service_->ClearSnippets(); | 117 ntp_snippets_service_->ClearCachedSuggestionsForDebugging(); |
118 } | 118 } |
119 | 119 |
120 void SnippetsInternalsMessageHandler::HandleClearDiscarded( | 120 void SnippetsInternalsMessageHandler::HandleClearDiscarded( |
121 const base::ListValue* args) { | 121 const base::ListValue* args) { |
122 DCHECK_EQ(0u, args->GetSize()); | 122 DCHECK_EQ(0u, args->GetSize()); |
123 | 123 |
124 ntp_snippets_service_->ClearDiscardedSnippets(); | 124 ntp_snippets_service_->ClearDiscardedSuggestionsForDebugging(); |
125 SendDiscardedSnippets(); | 125 SendDiscardedSnippets(); |
126 } | 126 } |
127 | 127 |
128 void SnippetsInternalsMessageHandler::HandleDownload( | 128 void SnippetsInternalsMessageHandler::HandleDownload( |
129 const base::ListValue* args) { | 129 const base::ListValue* args) { |
130 DCHECK_EQ(1u, args->GetSize()); | 130 DCHECK_EQ(1u, args->GetSize()); |
131 | 131 |
132 SendString("hosts-status", std::string()); | 132 SendString("hosts-status", std::string()); |
133 | 133 |
134 std::string hosts_string; | 134 std::string hosts_string; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 } | 228 } |
229 | 229 |
230 void SnippetsInternalsMessageHandler::SendString(const std::string& name, | 230 void SnippetsInternalsMessageHandler::SendString(const std::string& name, |
231 const std::string& value) { | 231 const std::string& value) { |
232 base::StringValue string_name(name); | 232 base::StringValue string_name(name); |
233 base::StringValue string_value(value); | 233 base::StringValue string_value(value); |
234 | 234 |
235 web_ui()->CallJavascriptFunctionUnsafe( | 235 web_ui()->CallJavascriptFunctionUnsafe( |
236 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); | 236 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); |
237 } | 237 } |
OLD | NEW |