| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 | 122 |
| 123 void SnippetsInternalsMessageHandler::OnCategoryStatusChanged( | 123 void SnippetsInternalsMessageHandler::OnCategoryStatusChanged( |
| 124 Category category, | 124 Category category, |
| 125 CategoryStatus new_status) { | 125 CategoryStatus new_status) { |
| 126 if (!dom_loaded_) | 126 if (!dom_loaded_) |
| 127 return; | 127 return; |
| 128 SendContentSuggestions(); | 128 SendContentSuggestions(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void SnippetsInternalsMessageHandler::OnSuggestionInvalidated( |
| 132 ntp_snippets::Category category, |
| 133 const std::string& suggestion_id) { |
| 134 if (!dom_loaded_) |
| 135 return; |
| 136 SendContentSuggestions(); |
| 137 } |
| 138 |
| 131 void SnippetsInternalsMessageHandler::ContentSuggestionsServiceShutdown() {} | 139 void SnippetsInternalsMessageHandler::ContentSuggestionsServiceShutdown() {} |
| 132 | 140 |
| 133 void SnippetsInternalsMessageHandler::HandleRefreshContent( | 141 void SnippetsInternalsMessageHandler::HandleRefreshContent( |
| 134 const base::ListValue* args) { | 142 const base::ListValue* args) { |
| 135 DCHECK_EQ(0u, args->GetSize()); | 143 DCHECK_EQ(0u, args->GetSize()); |
| 136 | 144 |
| 137 dom_loaded_ = true; | 145 dom_loaded_ = true; |
| 138 | 146 |
| 139 SendAllContent(); | 147 SendAllContent(); |
| 140 } | 148 } |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 310 } |
| 303 | 311 |
| 304 void SnippetsInternalsMessageHandler::SendString(const std::string& name, | 312 void SnippetsInternalsMessageHandler::SendString(const std::string& name, |
| 305 const std::string& value) { | 313 const std::string& value) { |
| 306 base::StringValue string_name(name); | 314 base::StringValue string_name(name); |
| 307 base::StringValue string_value(value); | 315 base::StringValue string_value(value); |
| 308 | 316 |
| 309 web_ui()->CallJavascriptFunctionUnsafe( | 317 web_ui()->CallJavascriptFunctionUnsafe( |
| 310 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); | 318 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); |
| 311 } | 319 } |
| OLD | NEW |