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