| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 195 SendBoolean("flag-offline-page-suggestions", | 195 SendBoolean("flag-offline-page-suggestions", |
| 196 base::FeatureList::IsEnabled( | 196 base::FeatureList::IsEnabled( |
| 197 ntp_snippets::kOfflinePageSuggestionsFeature)); | 197 ntp_snippets::kOfflinePageSuggestionsFeature)); |
| 198 | 198 |
| 199 SendBoolean("flag-physical-web-page-suggestions", |
| 200 base::FeatureList::IsEnabled( |
| 201 ntp_snippets::kPhysicalWebPageSuggestionsFeature)); |
| 202 |
| 199 web_ui()->CallJavascriptFunctionUnsafe( | 203 web_ui()->CallJavascriptFunctionUnsafe( |
| 200 "chrome.SnippetsInternals.setHostRestricted", | 204 "chrome.SnippetsInternals.setHostRestricted", |
| 201 base::FundamentalValue( | 205 base::FundamentalValue( |
| 202 ntp_snippets_service_->snippets_fetcher()->UsesHostRestrictions())); | 206 ntp_snippets_service_->snippets_fetcher()->UsesHostRestrictions())); |
| 203 | 207 |
| 204 switch (ntp_snippets_service_->snippets_fetcher()->personalization()) { | 208 switch (ntp_snippets_service_->snippets_fetcher()->personalization()) { |
| 205 case ntp_snippets::NTPSnippetsFetcher::Personalization::kPersonal: | 209 case ntp_snippets::NTPSnippetsFetcher::Personalization::kPersonal: |
| 206 SendString("switch-personalized", "Only personalized"); | 210 SendString("switch-personalized", "Only personalized"); |
| 207 break; | 211 break; |
| 208 case ntp_snippets::NTPSnippetsFetcher::Personalization::kBoth: | 212 case ntp_snippets::NTPSnippetsFetcher::Personalization::kBoth: |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 } | 297 } |
| 294 | 298 |
| 295 void SnippetsInternalsMessageHandler::SendString(const std::string& name, | 299 void SnippetsInternalsMessageHandler::SendString(const std::string& name, |
| 296 const std::string& value) { | 300 const std::string& value) { |
| 297 base::StringValue string_name(name); | 301 base::StringValue string_name(name); |
| 298 base::StringValue string_value(value); | 302 base::StringValue string_value(value); |
| 299 | 303 |
| 300 web_ui()->CallJavascriptFunctionUnsafe( | 304 web_ui()->CallJavascriptFunctionUnsafe( |
| 301 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); | 305 "chrome.SnippetsInternals.receiveProperty", string_name, string_value); |
| 302 } | 306 } |
| OLD | NEW |