| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 case ContentSuggestionsCategoryStatus::AVAILABLE_LOADING: | 95 case ContentSuggestionsCategoryStatus::AVAILABLE_LOADING: |
| 96 return "AVAILABLE_LOADING"; | 96 return "AVAILABLE_LOADING"; |
| 97 case ContentSuggestionsCategoryStatus::NOT_PROVIDED: | 97 case ContentSuggestionsCategoryStatus::NOT_PROVIDED: |
| 98 return "NOT_PROVIDED"; | 98 return "NOT_PROVIDED"; |
| 99 case ContentSuggestionsCategoryStatus::ALL_SUGGESTIONS_EXPLICITLY_DISABLED: | 99 case ContentSuggestionsCategoryStatus::ALL_SUGGESTIONS_EXPLICITLY_DISABLED: |
| 100 return "ALL_SUGGESTIONS_EXPLICITLY_DISABLED"; | 100 return "ALL_SUGGESTIONS_EXPLICITLY_DISABLED"; |
| 101 case ContentSuggestionsCategoryStatus::CATEGORY_EXPLICITLY_DISABLED: | 101 case ContentSuggestionsCategoryStatus::CATEGORY_EXPLICITLY_DISABLED: |
| 102 return "CATEGORY_EXPLICITLY_DISABLED"; | 102 return "CATEGORY_EXPLICITLY_DISABLED"; |
| 103 case ContentSuggestionsCategoryStatus::SIGNED_OUT: | 103 case ContentSuggestionsCategoryStatus::SIGNED_OUT: |
| 104 return "SIGNED_OUT"; | 104 return "SIGNED_OUT"; |
| 105 case ContentSuggestionsCategoryStatus::SYNC_DISABLED: | |
| 106 return "SYNC_DISABLED"; | |
| 107 case ContentSuggestionsCategoryStatus::PASSPHRASE_ENCRYPTION_ENABLED: | |
| 108 return "PASSPHRASE_ENCRYPTION_ENABLED"; | |
| 109 case ContentSuggestionsCategoryStatus::HISTORY_SYNC_DISABLED: | |
| 110 return "HISTORY_SYNC_DISABLED"; | |
| 111 case ContentSuggestionsCategoryStatus::LOADING_ERROR: | 105 case ContentSuggestionsCategoryStatus::LOADING_ERROR: |
| 112 return "LOADING_ERROR"; | 106 return "LOADING_ERROR"; |
| 113 } | 107 } |
| 114 return std::string(); | 108 return std::string(); |
| 115 } | 109 } |
| 116 | 110 |
| 117 } // namespace | 111 } // namespace |
| 118 | 112 |
| 119 SnippetsInternalsMessageHandler::SnippetsInternalsMessageHandler() | 113 SnippetsInternalsMessageHandler::SnippetsInternalsMessageHandler() |
| 120 : ntp_snippets_service_observer_(this), | 114 : ntp_snippets_service_observer_(this), |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 } | 368 } |
| 375 | 369 |
| 376 void SnippetsInternalsMessageHandler::SendString(const std::string& name, | 370 void SnippetsInternalsMessageHandler::SendString(const std::string& name, |
| 377 const std::string& value) { | 371 const std::string& value) { |
| 378 base::StringValue string_name(name); | 372 base::StringValue string_name(name); |
| 379 base::StringValue string_value(value); | 373 base::StringValue string_value(value); |
| 380 | 374 |
| 381 web_ui()->CallJavascriptFunctionUnsafe( | 375 web_ui()->CallJavascriptFunctionUnsafe( |
| 382 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); | 376 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); |
| 383 } | 377 } |
| OLD | NEW |