| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 base::Bind(&SnippetsInternalsMessageHandler::HandleClearCachedSuggestions, | 108 base::Bind(&SnippetsInternalsMessageHandler::HandleClearCachedSuggestions, |
| 109 base::Unretained(this))); | 109 base::Unretained(this))); |
| 110 | 110 |
| 111 web_ui()->RegisterMessageCallback( | 111 web_ui()->RegisterMessageCallback( |
| 112 "clearDismissedSuggestions", | 112 "clearDismissedSuggestions", |
| 113 base::Bind( | 113 base::Bind( |
| 114 &SnippetsInternalsMessageHandler::HandleClearDismissedSuggestions, | 114 &SnippetsInternalsMessageHandler::HandleClearDismissedSuggestions, |
| 115 base::Unretained(this))); | 115 base::Unretained(this))); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void SnippetsInternalsMessageHandler::OnNewSuggestions() { | 118 void SnippetsInternalsMessageHandler::OnNewSuggestions(Category category) { |
| 119 if (!dom_loaded_) | 119 if (!dom_loaded_) |
| 120 return; | 120 return; |
| 121 SendContentSuggestions(); | 121 SendContentSuggestions(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void SnippetsInternalsMessageHandler::OnCategoryStatusChanged( | 124 void SnippetsInternalsMessageHandler::OnCategoryStatusChanged( |
| 125 Category category, | 125 Category category, |
| 126 CategoryStatus new_status) { | 126 CategoryStatus new_status) { |
| 127 if (!dom_loaded_) | 127 if (!dom_loaded_) |
| 128 return; | 128 return; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 294 } |
| 295 | 295 |
| 296 void SnippetsInternalsMessageHandler::SendString(const std::string& name, | 296 void SnippetsInternalsMessageHandler::SendString(const std::string& name, |
| 297 const std::string& value) { | 297 const std::string& value) { |
| 298 base::StringValue string_name(name); | 298 base::StringValue string_name(name); |
| 299 base::StringValue string_value(value); | 299 base::StringValue string_value(value); |
| 300 | 300 |
| 301 web_ui()->CallJavascriptFunctionUnsafe( | 301 web_ui()->CallJavascriptFunctionUnsafe( |
| 302 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); | 302 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); |
| 303 } | 303 } |
| OLD | NEW |