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

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

Issue 370523002: Translate: Implement reset the denial state on chrome://translate-internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: estade's review Created 6 years, 5 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/translate_internals/translate_internals.js
diff --git a/chrome/browser/resources/translate_internals/translate_internals.js b/chrome/browser/resources/translate_internals/translate_internals.js
index 1e780744733724d175f865c5d0a347f24502945a..859daa53c0d6e2b5d72386673305fe9748e99721 100644
--- a/chrome/browser/resources/translate_internals/translate_internals.js
+++ b/chrome/browser/resources/translate_internals/translate_internals.js
@@ -60,6 +60,22 @@
activateTabByHash();
}
+ /*
+ * Creates a button to dismiss an item.
+ *
+ * @param {Function} func Callback called when the button is clicked.
+ */
+ function createDismissingButton(func) {
+ var button = document.createElement('button');
+ button.textContent = 'X';
+ button.classList.add('dismissing');
+ button.addEventListener('click', function(e) {
+ e.preventDefault();
+ func();
+ }, false);
+ return button;
+ }
+
/**
* Creates a new LI element with a button to dismiss the item.
*
@@ -72,15 +88,7 @@
var li = document.createElement('li');
li.appendChild(span);
-
- var button = document.createElement('button');
- button.textContent = 'X';
- button.addEventListener('click', function(e) {
- e.preventDefault();
- func();
- }, false);
-
- li.appendChild(button);
+ li.appendChild(createDismissingButton(func));
return li;
}
@@ -206,7 +214,13 @@
});
}
- var p = document.querySelector('#prefs-dump p');
+ var p = $('prefs-too-often-denied');
+ p.classList.toggle('prefs-setting-disabled',
+ !detail['translate_too_often_denied']);
+ p.appendChild(createDismissingButton(
+ chrome.send.bind(null, 'removePrefItem', ['too_often_denied'])));
+
+ p = document.querySelector('#prefs-dump p');
var content = JSON.stringify(detail, null, 2);
p.textContent = content;
}

Powered by Google App Engine
This is Rietveld 408576698