| 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 f54d777f31572dfbfe3fc1118b1c42ee47cb3dd5..71274affe1a6afc31ab83d2370aa79db67b9ba52 100644
|
| --- a/chrome/browser/resources/options/password_manager_list.js
|
| +++ b/chrome/browser/resources/options/password_manager_list.js
|
| @@ -10,9 +10,10 @@ cr.define('options.passwordManager', function() {
|
|
|
| // The following constants should be synchronized with the constants in
|
| // chrome/browser/ui/webui/options/password_manager_handler.cc.
|
| - /** @const */ var ORIGIN_FIELD = 'origin';
|
| - /** @const */ var SHOWN_URL_FIELD = 'shownUrl';
|
| + /** @const */ var URL_FIELD = 'url';
|
| + /** @const */ var SHOWN_ORIGIN_FIELD = 'shownOrigin';
|
| /** @const */ var IS_ANDROID_URI_FIELD = 'isAndroidUri';
|
| + /** @const */ var IS_CLICKABLE_FIELD = 'isClickable';
|
| /** @const */ var IS_SECURE_FIELD = 'isSecure';
|
| /** @const */ var USERNAME_FIELD = 'username';
|
| /** @const */ var PASSWORD_FIELD = 'password';
|
| @@ -42,15 +43,15 @@ cr.define('options.passwordManager', function() {
|
| }
|
|
|
| /**
|
| - * Returns title for password's origin. If the origin is Android URI, returns
|
| - * the origin as it is. Removes the scheme if the url is insecure and removes
|
| - * trailing punctuation symbols.
|
| + * Returns title for password's origin. If the origin is not clickable,
|
| + * returns the origin as it is. For clickable origins, removes the scheme if
|
| + * the url is insecure and removes trailing punctuation symbols.
|
| * @param {Object} item A dictionary of data on the list item.
|
| * @return {string} The title for password's origin.
|
| */
|
| function getTitleForPasswordOrigin(item) {
|
| var title = item.url;
|
| - if (item.isAndroidUri)
|
| + if (!item.isClickable)
|
| return title;
|
| if (!item.isSecure) {
|
| var ind = title.indexOf('://');
|
| @@ -62,16 +63,16 @@ cr.define('options.passwordManager', function() {
|
| }
|
|
|
| /**
|
| - * Helper function that creates an HTML element for displaying the origin of
|
| - * saved password.
|
| + * Helper function that creates an HTML element for displaying the link to
|
| + * the origin of saved password.
|
| * @param {Object} item A dictionary of data on the list item.
|
| * @param {Element} urlDiv div-element that will enclose the created
|
| * element.
|
| - * @return {Element} The element for displaying password origin.
|
| + * @return {Element} The element for displaying the link to the origin.
|
| */
|
| function createUrlLink(item, urlDiv) {
|
| var urlLink;
|
| - if (!item.isAndroidUri) {
|
| + if (item.isClickable) {
|
| urlLink = item.ownerDocument.createElement('a');
|
| urlLink.href = item.url;
|
| urlLink.setAttribute('target', '_blank');
|
| @@ -79,13 +80,40 @@ cr.define('options.passwordManager', function() {
|
| } else {
|
| urlLink = item.ownerDocument.createElement('span');
|
| }
|
| - urlLink.textContent = item.shownUrl;
|
| + urlLink.textContent = item.shownOrigin;
|
| urlLink.addEventListener('focus', function() {
|
| item.handleFocus();
|
| }.bind(item));
|
| return urlLink;
|
| }
|
|
|
| + /**
|
| + * Helper function that creates an HTML element for displaying the origin of
|
| + * saved password. It also sets some properties in |item|.
|
| + * @param {Object} item A dictionary of data on the list item.
|
| + * @return {Element} The element for displaying the origin of saved password.
|
| + */
|
| + function createUrlDiv(item) {
|
| + var urlDiv = cr.doc.createElement('div');
|
| + urlDiv.className = 'favicon-cell url';
|
| + urlDiv.setAttribute('title', getTitleForPasswordOrigin(item));
|
| + urlDiv.style.backgroundImage = getFaviconImageSet(
|
| + 'origin/' + item.url, 16);
|
| +
|
| + item.urlLink = createUrlLink(item, urlDiv);
|
| + urlDiv.appendChild(item.urlLink);
|
| +
|
| + if (item.isAndroidUri && item.isClickable) {
|
| + item.androidUriSuffix = cr.doc.createElement('span');
|
| + item.androidUriSuffix.textContent =
|
| + loadTimeData.getString('androidUriSuffix');
|
| + urlDiv.appendChild(item.androidUriSuffix);
|
| + }
|
| +
|
| + item.urlDiv = urlDiv;
|
| + return urlDiv;
|
| + }
|
| +
|
| PasswordListItem.prototype = {
|
| __proto__: DeletableItem.prototype,
|
|
|
| @@ -94,17 +122,7 @@ cr.define('options.passwordManager', function() {
|
| DeletableItem.prototype.decorate.call(this);
|
|
|
| // The URL of the site.
|
| - var urlDiv = this.ownerDocument.createElement('div');
|
| - urlDiv.className = 'favicon-cell url';
|
| - urlDiv.setAttribute('title', getTitleForPasswordOrigin(this));
|
| - urlDiv.style.backgroundImage = getFaviconImageSet(
|
| - 'origin/' + this.url, 16);
|
| -
|
| - this.urlLink = createUrlLink(this, urlDiv);
|
| - urlDiv.appendChild(this.urlLink);
|
| -
|
| - this.urlDiv = urlDiv;
|
| - this.contentElement.appendChild(urlDiv);
|
| + this.contentElement.appendChild(createUrlDiv(this));
|
|
|
| // The stored username.
|
| var usernameDiv = this.ownerDocument.createElement('div');
|
| @@ -258,81 +276,68 @@ cr.define('options.passwordManager', function() {
|
| },
|
|
|
| /**
|
| - * Get and set the URL for the entry.
|
| + * Get the URL for the entry.
|
| * @type {string}
|
| */
|
| get url() {
|
| - return this.dataItem[ORIGIN_FIELD];
|
| - },
|
| - set url(url) {
|
| - this.dataItem[ORIGIN_FIELD] = url;
|
| + return this.dataItem[URL_FIELD];
|
| },
|
|
|
| /**
|
| - * Get and set the shown url for the entry.
|
| + * Get the shown origin for the entry.
|
| * @type {string}
|
| */
|
| - get shownUrl() {
|
| - return this.dataItem[SHOWN_URL_FIELD];
|
| - },
|
| - set shownUrl(shownUrl) {
|
| - this.dataItem[SHOWN_URL_FIELD] = shownUrl;
|
| + get shownOrigin() {
|
| + return this.dataItem[SHOWN_ORIGIN_FIELD];
|
| },
|
|
|
| /**
|
| - * Get and set whether the origin is Android URI.
|
| + * Get whether the origin is Android URI.
|
| * @type {boolean}
|
| */
|
| get isAndroidUri() {
|
| return this.dataItem[IS_ANDROID_URI_FIELD];
|
| },
|
| - set isAndroidUri(isAndroidUri) {
|
| - this.dataItem[IS_ANDROID_URI_FIELD] = isAndroidUri;
|
| +
|
| + /**
|
| + * Get whether the origin is clickable.
|
| + * @type {boolean}
|
| + */
|
| + get isClickable() {
|
| + return this.dataItem[IS_CLICKABLE_FIELD];
|
| },
|
|
|
| /**
|
| - * Get and set whether the origin uses secure scheme.
|
| + * Get whether the origin uses secure scheme.
|
| * @type {boolean}
|
| */
|
| get isSecure() {
|
| return this.dataItem[IS_SECURE_FIELD];
|
| },
|
| - set isSecure(isSecure) {
|
| - this.dataItem[IS_SECURE_FIELD] = isSecure;
|
| - },
|
|
|
| /**
|
| - * Get and set the username for the entry.
|
| + * Get the username for the entry.
|
| * @type {string}
|
| */
|
| get username() {
|
| return this.dataItem[USERNAME_FIELD];
|
| },
|
| - set username(username) {
|
| - this.dataItem[USERNAME_FIELD] = username;
|
| - },
|
|
|
| /**
|
| - * Get and set the password for the entry.
|
| + * Get the password for the entry.
|
| * @type {string}
|
| */
|
| get password() {
|
| return this.dataItem[PASSWORD_FIELD];
|
| },
|
| - set password(password) {
|
| - this.dataItem[PASSWORD_FIELD] = password;
|
| - },
|
|
|
| /**
|
| - * Get and set the federation for the entry.
|
| + * Get the federation for the entry.
|
| * @type {string}
|
| */
|
| get federation() {
|
| return this.dataItem[FEDERATION_FIELD];
|
| },
|
| - set federation(federation) {
|
| - this.dataItem[FEDERATION_FIELD] = federation;
|
| - },
|
| };
|
|
|
| /**
|
| @@ -360,17 +365,7 @@ cr.define('options.passwordManager', function() {
|
| DeletableItem.prototype.decorate.call(this);
|
|
|
| // The URL of the site.
|
| - var urlDiv = this.ownerDocument.createElement('div');
|
| - urlDiv.className = 'favicon-cell url';
|
| - urlDiv.setAttribute('title', getTitleForPasswordOrigin(this));
|
| - urlDiv.style.backgroundImage = getFaviconImageSet(
|
| - 'origin/' + this.url, 16);
|
| -
|
| - this.urlLink = createUrlLink(this, urlDiv);
|
| - urlDiv.appendChild(this.urlLink);
|
| -
|
| - this.urlDiv = urlDiv;
|
| - this.contentElement.appendChild(urlDiv);
|
| + this.contentElement.appendChild(createUrlDiv(this));
|
| },
|
|
|
| /** @override */
|
| @@ -399,44 +394,40 @@ cr.define('options.passwordManager', function() {
|
| * @type {string}
|
| */
|
| get url() {
|
| - return this.dataItem[ORIGIN_FIELD];
|
| - },
|
| - set url(url) {
|
| - this.dataItem[ORIGIN_FIELD] = url;
|
| + return this.dataItem[URL_FIELD];
|
| },
|
|
|
| /**
|
| - * Get and set the shown url for the entry.
|
| + * Get the shown origin for the entry.
|
| * @type {string}
|
| */
|
| - get shownUrl() {
|
| - return this.dataItem[SHOWN_URL_FIELD];
|
| - },
|
| - set shownUrl(shownUrl) {
|
| - this.dataItem[SHOWN_URL_FIELD] = shownUrl;
|
| + get shownOrigin() {
|
| + return this.dataItem[SHOWN_ORIGIN_FIELD];
|
| },
|
|
|
| /**
|
| - * Get and set whether the origin is Android URI.
|
| + * Get whether the origin is Android URI.
|
| * @type {boolean}
|
| */
|
| get isAndroidUri() {
|
| return this.dataItem[IS_ANDROID_URI_FIELD];
|
| },
|
| - set isAndroidUri(isAndroidUri) {
|
| - this.dataItem[IS_ANDROID_URI_FIELD] = isAndroidUri;
|
| +
|
| + /**
|
| + * Get whether the origin is clickable.
|
| + * @type {boolean}
|
| + */
|
| + get isClickable() {
|
| + return this.dataItem[IS_CLICKABLE_FIELD];
|
| },
|
|
|
| /**
|
| - * Get and set whether the origin uses secure scheme.
|
| + * Get whether the origin uses secure scheme.
|
| * @type {boolean}
|
| */
|
| get isSecure() {
|
| return this.dataItem[IS_SECURE_FIELD];
|
| },
|
| - set isSecure(isSecure) {
|
| - this.dataItem[IS_SECURE_FIELD] = isSecure;
|
| - },
|
| };
|
|
|
| /**
|
| @@ -553,8 +544,10 @@ cr.define('options.passwordManager', function() {
|
| PasswordExceptionsListItem: PasswordExceptionsListItem,
|
| PasswordsList: PasswordsList,
|
| PasswordExceptionsList: PasswordExceptionsList,
|
| - ORIGIN_FIELD: ORIGIN_FIELD,
|
| - SHOWN_URL_FIELD: SHOWN_URL_FIELD,
|
| + URL_FIELD: URL_FIELD,
|
| + SHOWN_ORIGIN_FIELD: SHOWN_ORIGIN_FIELD,
|
| + IS_ANDROID_URI_FIELD: IS_ANDROID_URI_FIELD,
|
| + IS_CLICKABLE_FIELD: IS_CLICKABLE_FIELD,
|
| IS_SECURE_FIELD: IS_SECURE_FIELD,
|
| USERNAME_FIELD: USERNAME_FIELD,
|
| PASSWORD_FIELD: PASSWORD_FIELD,
|
|
|