Chromium Code Reviews| Index: chrome/browser/ui/webui/snippets_internals_message_handler.cc |
| diff --git a/chrome/browser/ui/webui/snippets_internals_message_handler.cc b/chrome/browser/ui/webui/snippets_internals_message_handler.cc |
| index a0f4ad8eefcbb704455c9a7bcb155771368334a5..71d20e77daea8d54553c8036f6fb20dc354be75b 100644 |
| --- a/chrome/browser/ui/webui/snippets_internals_message_handler.cc |
| +++ b/chrome/browser/ui/webui/snippets_internals_message_handler.cc |
| @@ -71,7 +71,6 @@ void SnippetsInternalsMessageHandler::NTPSnippetsServiceLoaded() { |
| if (!dom_loaded_) return; |
| SendSnippets(); |
| - SendDiscardedSnippets(); |
| web_ui()->CallJavascriptFunction( |
| "chrome.SnippetsInternals.receiveJson", |
| @@ -164,12 +163,21 @@ void SnippetsInternalsMessageHandler::SendInitialData() { |
| SendBoolean("flag-snippets", base::FeatureList::IsEnabled( |
| chrome::android::kNTPSnippetsFeature)); |
| - bool restricted = !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| - ntp_snippets::switches::kDontRestrict); |
| - SendBoolean("switch-restrict-to-hosts", restricted); |
| - const std::string help(restricted ? "(specify at least one host)" : |
| - "(unrestricted if no host is given)"); |
| - SendString("hosts-help", help); |
| + bool host_restricted = ntp_snippets_service_->UseHostRestriction(); |
| + SendBoolean("switch-restrict-to-hosts", host_restricted); |
| + if (!host_restricted) { |
| + web_ui()->CallJavascriptFunction( |
| + "chrome.SnippetsInternals.hideHostRestricts"); |
|
Bernhard Bauer
2016/05/18 10:08:03
If you add a dedicated method here anyway, you cou
jkrcal
2016/05/19 07:30:28
Done.
|
| + } |
| + |
| + ntp_snippets::NTPSnippetsFetcher::Personalization personal = |
| + ntp_snippets_service_->personalization(); |
| + if (personal == ntp_snippets::NTPSnippetsFetcher::Personalization::kPersonal) |
| + SendString("switch-personalized", "Only personalized"); |
|
Bernhard Bauer
2016/05/18 10:08:03
Use a switch statement so the compiler can check y
jkrcal
2016/05/19 07:30:28
Done.
|
| + else if (personal == ntp_snippets::NTPSnippetsFetcher::Personalization::kBoth) |
| + SendString("switch-personalized", "Both personalized and non-personalized"); |
| + else |
| + SendString("switch-personalized", "Only non-personalized"); |
| SendSnippets(); |
| SendDiscardedSnippets(); |