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

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

Issue 6241010: DOMUI: Use a styled button instead of an image for the password list show/hide (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 505384cd7eb1eb836d5865d47cea627eb1f56734..58f4ef6ce1b5bea653a3aa156362a5bf7b6804a0 100644
--- a/chrome/browser/resources/options/password_manager_list.js
+++ b/chrome/browser/resources/options/password_manager_list.js
@@ -32,8 +32,7 @@ cr.define('options.passwordManager', function() {
// The URL of the site.
var urlLabel = this.ownerDocument.createElement('div');
- urlLabel.className = 'url';
- urlLabel.classList.add('favicon-cell');
+ urlLabel.className = 'favicon-cell url';
stuartmorgan 2011/01/21 00:05:05 Two classList.add lines instead?
James Hawkins 2011/01/21 00:34:51 Done.
urlLabel.textContent = this.url;
urlLabel.style.backgroundImage = url('chrome://favicon/' + this.url);
this.contentElement.appendChild(urlLabel);
@@ -50,17 +49,18 @@ cr.define('options.passwordManager', function() {
// The password input field.
var passwordInput = this.ownerDocument.createElement('input');
+ passwordInput.type = 'password';
passwordInput.className = 'inactive-password';
passwordInput.readOnly = true;
- passwordInput.type = 'password';
passwordInput.value = this.password;
passwordInputDiv.appendChild(passwordInput);
// The show/hide button.
- var buttonSpan = this.ownerDocument.createElement('span');
- buttonSpan.className = 'hidden';
- buttonSpan.addEventListener('click', this.onClick_, true);
- passwordInputDiv.appendChild(buttonSpan);
+ var button = this.ownerDocument.createElement('button');
+ button.className = 'hidden password-button';
stuartmorgan 2011/01/21 00:05:05 Same
James Hawkins 2011/01/21 00:34:51 Done.
+ button.textContent = localStrings.getString('passwordShowButton');
+ button.addEventListener('click', this.onClick_, true);
+ passwordInputDiv.appendChild(button);
this.contentElement.appendChild(passwordInputDiv);
},
@@ -70,13 +70,13 @@ cr.define('options.passwordManager', function() {
var passwordInput = this.querySelector('input[type=password]');
var textInput = this.querySelector('input[type=text]');
var input = passwordInput || textInput;
- var buttonSpan = input.nextSibling;
+ var button = input.nextSibling;
if (this.selected) {
input.classList.remove('inactive-password');
- buttonSpan.classList.remove('hidden');
+ button.classList.remove('hidden');
} else {
input.classList.add('inactive-password');
- buttonSpan.classList.add('hidden');
+ button.classList.add('hidden');
}
},
@@ -86,11 +86,16 @@ cr.define('options.passwordManager', function() {
* @private
*/
onClick_: function(event) {
- // The password is the input element previous to the button span.
- var buttonSpan = event.currentTarget;
- var passwordInput = buttonSpan.previousSibling;
- var type = passwordInput.type;
- passwordInput.type = type == 'password' ? 'text' : 'password';
+ // The password is the input element previous to the button.
+ var button = event.currentTarget;
+ var passwordInput = button.previousSibling;
+ if (passwordInput.type == 'password') {
+ passwordInput.type = 'text';
+ button.textContent = localStrings.getString('passwordHideButton');
+ } else {
+ passwordInput.type = 'password';
+ button.textContent = localStrings.getString('passwordShowButton');
+ }
},
/**

Powered by Google App Engine
This is Rietveld 408576698