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

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: Review fixes. 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..b286e8e610c04a97fc03e556f339755de64cb033 100644
--- a/chrome/browser/resources/options/password_manager_list.js
+++ b/chrome/browser/resources/options/password_manager_list.js
@@ -32,8 +32,8 @@ 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.classList.add('url');
urlLabel.textContent = this.url;
urlLabel.style.backgroundImage = url('chrome://favicon/' + this.url);
this.contentElement.appendChild(urlLabel);
@@ -50,17 +50,19 @@ 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.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);
},
@@ -70,13 +72,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 +88,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');
+ }
},
/**
« no previous file with comments | « chrome/browser/resources/options/password_manager_list.css ('k') | chrome/browser/resources/options/search_engine_manager.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698