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

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: Kenji's suggestion 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..41902ed3c0a2639ad98f5830f493c2661d74c6c5 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,14 @@
});
}
- 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(function() {
Evan Stade 2014/07/07 16:12:39 I think if you do: p.appendChild(createDismissing
hajimehoshi 2014/07/08 05:33:47 Done.
+ chrome.send('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