Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: chrome/browser/ui/webui/snippets_internals_message_handler.cc

Issue 1978513002: Getting the personalization info in chrome://snippets-internals correct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Polish Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698