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

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

Issue 1615653005: [Password manager] Human readable origins for Android credentials on chrome://settings/passwords (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adapt to new implementation of left elided origins Created 4 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 f54d777f31572dfbfe3fc1118b1c42ee47cb3dd5..16f5efce2b463e8ed223661021c81054f93c7c48 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('://');
@@ -71,7 +72,7 @@ cr.define('options.passwordManager', function() {
*/
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,24 @@ 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 that is appended to the
+ * clickable origins of Android credentials.
+ * @return {Element} The element to append Android clickable origins.
+ */
+ function createAndroidSpan() {
+ var androidSpan = cr.doc.createElement('span');
+ androidSpan.textContent = ' (Android)';
Evan Stade 2016/03/22 20:13:37 I think this needs to be left up to translators. A
Dan Beam 2016/03/22 20:36:49 content: "$i18n{...}"; might work in the near futu
kolos1 2016/03/22 21:00:52 Where shall I define androidUriSuffix} that will b
+ return androidSpan;
+ }
+
PasswordListItem.prototype = {
__proto__: DeletableItem.prototype,
@@ -103,6 +115,11 @@ cr.define('options.passwordManager', function() {
this.urlLink = createUrlLink(this, urlDiv);
urlDiv.appendChild(this.urlLink);
+ if (this.isAndroidUri && this.isClickable) {
+ this.androidSpan = createAndroidSpan();
+ urlDiv.appendChild(this.androidSpan);
+ }
+
this.urlDiv = urlDiv;
this.contentElement.appendChild(urlDiv);
@@ -262,21 +279,21 @@ cr.define('options.passwordManager', function() {
* @type {string}
*/
get url() {
- return this.dataItem[ORIGIN_FIELD];
+ return this.dataItem[URL_FIELD];
},
set url(url) {
- this.dataItem[ORIGIN_FIELD] = url;
+ this.dataItem[URL_FIELD] = url;
},
/**
- * Get and set the shown url for the entry.
+ * Get and set the shown origin for the entry.
* @type {string}
*/
- get shownUrl() {
- return this.dataItem[SHOWN_URL_FIELD];
+ get shownOrigin() {
+ return this.dataItem[SHOWN_ORIGIN_FIELD];
},
- set shownUrl(shownUrl) {
- this.dataItem[SHOWN_URL_FIELD] = shownUrl;
+ set shownOrigin(shownOrigin) {
+ this.dataItem[SHOWN_ORIGIN_FIELD] = shownOrigin;
},
/**
@@ -291,6 +308,17 @@ cr.define('options.passwordManager', function() {
},
/**
+ * Get and set whether the origin is clickable.
+ * @type {boolean}
+ */
+ get isClickable() {
+ return this.dataItem[IS_CLICKABLE_FIELD];
+ },
+ set isClickable(isClickable) {
Evan Stade 2016/03/22 20:13:37 is this used?
+ this.dataItem[IS_CLICKABLE_FIELD] = isClickable;
+ },
+
+ /**
* Get and set whether the origin uses secure scheme.
* @type {boolean}
*/
@@ -399,21 +427,21 @@ cr.define('options.passwordManager', function() {
* @type {string}
*/
get url() {
- return this.dataItem[ORIGIN_FIELD];
+ return this.dataItem[URL_FIELD];
},
set url(url) {
- this.dataItem[ORIGIN_FIELD] = url;
+ this.dataItem[URL_FIELD] = url;
},
/**
- * Get and set the shown url for the entry.
+ * Get and set the shown origin for the entry.
* @type {string}
*/
- get shownUrl() {
- return this.dataItem[SHOWN_URL_FIELD];
+ get shownOrigin() {
+ return this.dataItem[SHOWN_ORIGIN_FIELD];
},
- set shownUrl(shownUrl) {
- this.dataItem[SHOWN_URL_FIELD] = shownUrl;
+ set shownOrigin(shownOrigin) {
+ this.dataItem[SHOWN_ORIGIN_FIELD] = shownOrigin;
},
/**
@@ -428,6 +456,17 @@ cr.define('options.passwordManager', function() {
},
/**
+ * Get and set whether the origin is clickable.
+ * @type {boolean}
+ */
+ get isClickable() {
+ return this.dataItem[IS_CLICKABLE_FIELD];
+ },
+ set isClickable(isClickable) {
+ this.dataItem[IS_CLICKABLE_FIELD] = isClickable;
+ },
+
+ /**
* Get and set whether the origin uses secure scheme.
* @type {boolean}
*/
@@ -553,8 +592,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,
« no previous file with comments | « chrome/browser/resources/options/password_manager.js ('k') | chrome/browser/ui/passwords/password_manager_presenter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698