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

Unified Diff: chrome/browser/resources/snippets_internals.js

Issue 1978513002: Getting the personalization info in chrome://snippets-internals correct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: After code review #2 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/resources/snippets_internals.js
diff --git a/chrome/browser/resources/snippets_internals.js b/chrome/browser/resources/snippets_internals.js
index b66c94100c5e26522bed565ea0ac1d327d46c858..a9f7b57141ccf56d7e4987516aa520836b08eccf 100644
--- a/chrome/browser/resources/snippets_internals.js
+++ b/chrome/browser/resources/snippets_internals.js
@@ -38,6 +38,13 @@ cr.define('chrome.SnippetsInternals', function() {
chrome.send('loaded');
}
+ function setHostRestricted(restricted) {
+ receiveProperty('switch-restrict-to-hosts', restricted ? 'True' : 'False');
+ if (!restricted) {
+ $('hosts-restrict').classList.add('hidden');
+ }
+ }
+
function receiveProperty(propertyId, value) {
$(propertyId).textContent = value;
}
@@ -59,8 +66,11 @@ cr.define('chrome.SnippetsInternals', function() {
}
function receiveJson(json) {
- receiveProperty('last-json-text', json);
- if (json) {
+ var trimmed = json.trim();
+ var hasContent = (trimmed && trimmed != '{}');
+
+ if (hasContent) {
+ receiveProperty('last-json-text', trimmed);
$('last-json').classList.remove('hidden');
} else {
$('last-json').classList.add('hidden');
@@ -106,6 +116,7 @@ cr.define('chrome.SnippetsInternals', function() {
// Return an object with all of the exports.
return {
initialize: initialize,
+ setHostRestricted: setHostRestricted,
receiveProperty: receiveProperty,
receiveHosts: receiveHosts,
receiveSnippets: receiveSnippets,
« no previous file with comments | « chrome/browser/resources/snippets_internals.html ('k') | chrome/browser/ui/webui/snippets_internals_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698