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

Unified Diff: chrome/browser/resources/options/password_manager_list.js

Issue 6770012: Handle the PasswordManagerAllowShowPasswords preference in the options webui. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Keep password column, show "IT-admin" banner Created 9 years, 9 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/options/password_manager_list.js
diff --git a/chrome/browser/resources/options/password_manager_list.js b/chrome/browser/resources/options/password_manager_list.js
index b286e8e610c04a97fc03e556f339755de64cb033..b15aace46c09d86ad3344a8296d39542536d6401 100644
--- a/chrome/browser/resources/options/password_manager_list.js
+++ b/chrome/browser/resources/options/password_manager_list.js
@@ -14,10 +14,11 @@ cr.define('options.passwordManager', function() {
* @constructor
* @extends {cr.ui.ListItem}
*/
- function PasswordListItem(entry) {
+ function PasswordListItem(entry, showPassword) {
var el = cr.doc.createElement('div');
el.dataItem = entry;
el.__proto__ = PasswordListItem.prototype;
+ el.showPassword = showPassword;
el.decorate();
return el;
@@ -57,18 +58,23 @@ cr.define('options.passwordManager', function() {
passwordInputDiv.appendChild(passwordInput);
// The show/hide button.
- var button = this.ownerDocument.createElement('button');
- button.classList.add('hidden');
- button.classList.add('password-button');
- button.textContent = localStrings.getString('passwordShowButton');
- button.addEventListener('click', this.onClick_, true);
- passwordInputDiv.appendChild(button);
+ if (this.showPassword) {
+ var button = this.ownerDocument.createElement('button');
+ button.classList.add('hidden');
+ button.classList.add('password-button');
+ button.textContent = localStrings.getString('passwordShowButton');
+ button.addEventListener('click', this.onClick_, true);
+ passwordInputDiv.appendChild(button);
+ }
this.contentElement.appendChild(passwordInputDiv);
},
/** @inheritDoc */
selectionChanged: function() {
+ if (!this.showPassword)
+ return;
+
var passwordInput = this.querySelector('input[type=password]');
var textInput = this.querySelector('input[type=text]');
var input = passwordInput || textInput;
@@ -191,7 +197,7 @@ cr.define('options.passwordManager', function() {
/** @inheritDoc */
createItem: function(entry) {
- return new PasswordListItem(entry);
+ return new PasswordListItem(entry, this.showPasswords);
},
/** @inheritDoc */
@@ -205,6 +211,12 @@ cr.define('options.passwordManager', function() {
get length() {
return this.dataModel.length;
},
+
+ /**
+ * Whether passwords can be displayed in clear text or not.
+ * @type {boolean}
+ */
+ showPasswords: true,
};
/**

Powered by Google App Engine
This is Rietveld 408576698