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

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: 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..a6abe98660f9b7039ff1215837a390696f96b36f 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;
@@ -44,31 +45,35 @@ cr.define('options.passwordManager', function() {
usernameLabel.textContent = this.username;
this.contentElement.appendChild(usernameLabel);
- // The stored password.
- var passwordInputDiv = this.ownerDocument.createElement('div');
- passwordInputDiv.className = 'password';
+ if (this.showPassword) {
James Hawkins 2011/03/29 17:37:23 if (!this.showPassword) return; ^ Huge indented
Joao da Silva 2011/03/31 10:03:22 This has moved a couple of lines down.
+ // The stored password.
+ var passwordInputDiv = this.ownerDocument.createElement('div');
+ passwordInputDiv.className = 'password';
stuartmorgan 2011/03/29 15:24:58 Having a huge blank space on the right hand side o
James Hawkins 2011/03/29 17:37:23 Agreed. Are we showing some sort of UI to the user
Joao da Silva 2011/03/31 10:03:22 Fixed. The password input div is kept, but the "sh
Joao da Silva 2011/03/31 10:03:22 When a preference is managed by policy there is a
- // The password input field.
- var passwordInput = this.ownerDocument.createElement('input');
- passwordInput.type = 'password';
- passwordInput.className = 'inactive-password';
- passwordInput.readOnly = true;
- passwordInput.value = this.password;
- passwordInputDiv.appendChild(passwordInput);
+ // The password input field.
+ var passwordInput = this.ownerDocument.createElement('input');
+ passwordInput.type = 'password';
+ passwordInput.className = 'inactive-password';
+ passwordInput.readOnly = true;
+ passwordInput.value = this.password;
+ 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);
+ // 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);
- this.contentElement.appendChild(passwordInputDiv);
+ this.contentElement.appendChild(passwordInputDiv);
+ }
},
/** @inheritDoc */
selectionChanged: function() {
+ if (!this.showPassword)
+ return;
James Hawkins 2011/03/29 17:37:23 nit: Blank line after if block.
Joao da Silva 2011/03/31 10:03:22 Done.
var passwordInput = this.querySelector('input[type=password]');
var textInput = this.querySelector('input[type=text]');
var input = passwordInput || textInput;
@@ -191,7 +196,7 @@ cr.define('options.passwordManager', function() {
/** @inheritDoc */
createItem: function(entry) {
- return new PasswordListItem(entry);
+ return new PasswordListItem(entry, this.showPasswords);
},
/** @inheritDoc */
@@ -205,6 +210,8 @@ cr.define('options.passwordManager', function() {
get length() {
return this.dataModel.length;
},
+
+ showPasswords: true,
James Hawkins 2011/03/29 17:37:23 Document.
James Hawkins 2011/03/29 17:37:23 s/showPasswords/showPasswords_/ since it's presuma
Joao da Silva 2011/03/31 10:03:22 Done.
Joao da Silva 2011/03/31 10:03:22 It's not private. Should a getter and setter be us
};
/**

Powered by Google App Engine
This is Rietveld 408576698