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 9578199f171fc0e474b943e6a835dd64c693c1da..ab5e0cf5480378352c634b1916a25cd3a4b6120e 100644 |
--- a/chrome/browser/resources/options/password_manager_list.js |
+++ b/chrome/browser/resources/options/password_manager_list.js |
@@ -12,8 +12,9 @@ cr.define('options.passwordManager', function() { |
* Creates a new passwords list item. |
* @param {cr.ui.ArrayDataModel} dataModel The data model that contains this |
* item. |
- * @param {Array} entry An array of the form [url, username, password]. When |
- * the list has been filtered, a fourth element [index] may be present. |
+ * @param {Array} entry An array of the form [url, username, password, |
+ * federation]. When the list has been filtered, a fifth element [index] |
+ * may be present. |
Dan Beam
2015/03/03 22:49:54
nit:
/** @const {number} */ var URL_DATA_INDEX
|
* @param {boolean} showPasswords If true, add a button to the element to |
* allow the user to reveal the saved password. |
* @constructor |
@@ -61,45 +62,53 @@ cr.define('options.passwordManager', function() { |
usernameLabel.title = this.username; |
this.contentElement.appendChild(usernameLabel); |
- // The stored password. |
- var passwordInputDiv = this.ownerDocument.createElement('div'); |
- passwordInputDiv.className = 'password'; |
- |
- // The password input field. |
- var passwordInput = this.ownerDocument.createElement('input'); |
- passwordInput.type = 'password'; |
- passwordInput.className = 'inactive-password'; |
- passwordInput.readOnly = true; |
- passwordInput.value = this.showPasswords_ ? this.password : '********'; |
- passwordInputDiv.appendChild(passwordInput); |
- var deletableItem = this; |
- passwordInput.addEventListener('focus', function() { |
- deletableItem.handleFocus(); |
- }); |
- this.passwordField = passwordInput; |
- this.setFocusable_(false); |
- |
- // The show/hide button. |
- if (this.showPasswords_) { |
- var button = this.ownerDocument.createElement('button'); |
- button.hidden = true; |
- button.className = 'list-inline-button custom-appearance'; |
- button.textContent = loadTimeData.getString('passwordShowButton'); |
- button.addEventListener('click', this.onClick_.bind(this), true); |
- button.addEventListener('mousedown', function(event) { |
- // Don't focus on this button by mousedown. |
- event.preventDefault(); |
- // Don't handle list item selection. It causes focus change. |
- event.stopPropagation(); |
- }, false); |
- button.addEventListener('focus', function() { |
+ if (this.federation) { |
+ // The federation. |
+ var federationDiv = this.ownerDocument.createElement('div'); |
+ federationDiv.className = 'federation'; |
+ federationDiv.textContent = this.federation; |
+ this.contentElement.appendChild(federationDiv); |
+ } else { |
+ // The stored password. |
+ var passwordInputDiv = this.ownerDocument.createElement('div'); |
+ passwordInputDiv.className = 'password'; |
+ |
+ // The password input field. |
+ var passwordInput = this.ownerDocument.createElement('input'); |
+ passwordInput.type = 'password'; |
+ passwordInput.className = 'inactive-password'; |
+ passwordInput.readOnly = true; |
+ passwordInput.value = this.showPasswords_ ? this.password : '********'; |
+ passwordInputDiv.appendChild(passwordInput); |
+ var deletableItem = this; |
+ passwordInput.addEventListener('focus', function() { |
deletableItem.handleFocus(); |
}); |
- passwordInputDiv.appendChild(button); |
- this.passwordShowButton = button; |
+ this.passwordField = passwordInput; |
+ this.setFocusable_(false); |
+ |
+ // The show/hide button. |
+ if (this.showPasswords_) { |
+ var button = this.ownerDocument.createElement('button'); |
+ button.hidden = true; |
+ button.className = 'list-inline-button custom-appearance'; |
+ button.textContent = loadTimeData.getString('passwordShowButton'); |
+ button.addEventListener('click', this.onClick_.bind(this), true); |
+ button.addEventListener('mousedown', function(event) { |
+ // Don't focus on this button by mousedown. |
+ event.preventDefault(); |
+ // Don't handle list item selection. It causes focus change. |
+ event.stopPropagation(); |
+ }, false); |
+ button.addEventListener('focus', function() { |
+ deletableItem.handleFocus(); |
+ }); |
+ passwordInputDiv.appendChild(button); |
+ this.passwordShowButton = button; |
+ } |
+ this.contentElement.appendChild(passwordInputDiv); |
} |
- this.contentElement.appendChild(passwordInputDiv); |
}, |
/** @override */ |
@@ -161,7 +170,7 @@ cr.define('options.passwordManager', function() { |
* @private |
*/ |
getOriginalIndex_: function() { |
- var index = this.dataItem[3]; |
+ var index = this.dataItem[4]; |
return index ? index : this.dataModel.indexOf(this.dataItem); |
}, |
@@ -211,6 +220,17 @@ cr.define('options.passwordManager', function() { |
set password(password) { |
this.dataItem[2] = password; |
}, |
+ |
+ /** |
+ * Get and set the federation for the entry. |
+ * @type {string} |
+ */ |
+ get federation() { |
+ return this.dataItem[3]; |
+ }, |
+ set federation(federation) { |
+ this.dataItem[3] = password; |
+ }, |
}; |
/** |
@@ -318,9 +338,9 @@ cr.define('options.passwordManager', function() { |
/** @override */ |
deleteItemAtIndex: function(index) { |
var item = this.dataModel.item(index); |
- if (item && item.length > 3) { |
- // The fourth element, if present, is the original index to delete. |
- index = item[3]; |
+ if (item && item.length > 4) { |
Dan Beam
2015/03/03 22:49:54
nit:
if (item && item[FEDERATION_INDEX]) { //
|
+ // The fifth element, if present, is the original index to delete. |
+ index = item[4]; |
} |
PasswordManager.removeSavedPassword(index); |
}, |