| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 category_id); | 184 category_id); |
| 185 content_suggestions_service_->ClearDismissedSuggestionsForDebugging(category); | 185 content_suggestions_service_->ClearDismissedSuggestionsForDebugging(category); |
| 186 SendContentSuggestions(); | 186 SendContentSuggestions(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void SnippetsInternalsMessageHandler::SendAllContent() { | 189 void SnippetsInternalsMessageHandler::SendAllContent() { |
| 190 SendHosts(); | 190 SendHosts(); |
| 191 | 191 |
| 192 SendBoolean("flag-snippets", base::FeatureList::IsEnabled( | 192 SendBoolean("flag-snippets", base::FeatureList::IsEnabled( |
| 193 ntp_snippets::kContentSuggestionsFeature)); | 193 ntp_snippets::kContentSuggestionsFeature)); |
| 194 | 194 SendBoolean("flag-recent-offline-tab-suggestions", |
| 195 SendBoolean("flag-offline-page-suggestions", | |
| 196 base::FeatureList::IsEnabled( | 195 base::FeatureList::IsEnabled( |
| 197 ntp_snippets::kOfflinePageSuggestionsFeature)); | 196 ntp_snippets::kRecentOfflineTabSuggestionsFeature)); |
| 197 SendBoolean( |
| 198 "flag-download-suggestions", |
| 199 base::FeatureList::IsEnabled(ntp_snippets::kDownloadSuggestionsFeature)); |
| 200 SendBoolean( |
| 201 "flag-bookmark-suggestions", |
| 202 base::FeatureList::IsEnabled(ntp_snippets::kBookmarkSuggestionsFeature)); |
| 198 | 203 |
| 199 web_ui()->CallJavascriptFunctionUnsafe( | 204 web_ui()->CallJavascriptFunctionUnsafe( |
| 200 "chrome.SnippetsInternals.setHostRestricted", | 205 "chrome.SnippetsInternals.setHostRestricted", |
| 201 base::FundamentalValue( | 206 base::FundamentalValue( |
| 202 ntp_snippets_service_->snippets_fetcher()->UsesHostRestrictions())); | 207 ntp_snippets_service_->snippets_fetcher()->UsesHostRestrictions())); |
| 203 | 208 |
| 204 switch (ntp_snippets_service_->snippets_fetcher()->personalization()) { | 209 switch (ntp_snippets_service_->snippets_fetcher()->personalization()) { |
| 205 case ntp_snippets::NTPSnippetsFetcher::Personalization::kPersonal: | 210 case ntp_snippets::NTPSnippetsFetcher::Personalization::kPersonal: |
| 206 SendString("switch-personalized", "Only personalized"); | 211 SendString("switch-personalized", "Only personalized"); |
| 207 break; | 212 break; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 } | 298 } |
| 294 | 299 |
| 295 void SnippetsInternalsMessageHandler::SendString(const std::string& name, | 300 void SnippetsInternalsMessageHandler::SendString(const std::string& name, |
| 296 const std::string& value) { | 301 const std::string& value) { |
| 297 base::StringValue string_name(name); | 302 base::StringValue string_name(name); |
| 298 base::StringValue string_value(value); | 303 base::StringValue string_value(value); |
| 299 | 304 |
| 300 web_ui()->CallJavascriptFunctionUnsafe( | 305 web_ui()->CallJavascriptFunctionUnsafe( |
| 301 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); | 306 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); |
| 302 } | 307 } |
| OLD | NEW |