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

Side by Side Diff: chrome/browser/resources/options/password_manager_list.js

Issue 1826533003: Revert of [Password Manager] Changes implementation of left elided origin on chrome://settings/passwords (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/options/password_manager_list.css ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('options.passwordManager', function() { 5 cr.define('options.passwordManager', function() {
6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; 6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
7 /** @const */ var DeletableItemList = options.DeletableItemList; 7 /** @const */ var DeletableItemList = options.DeletableItemList;
8 /** @const */ var DeletableItem = options.DeletableItem; 8 /** @const */ var DeletableItem = options.DeletableItem;
9 /** @const */ var List = cr.ui.List; 9 /** @const */ var List = cr.ui.List;
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 function getTitleForPasswordOrigin(item) { 51 function getTitleForPasswordOrigin(item) {
52 var title = item.url; 52 var title = item.url;
53 if (item.isAndroidUri) 53 if (item.isAndroidUri)
54 return title; 54 return title;
55 if (!item.isSecure) { 55 if (!item.isSecure) {
56 var ind = title.indexOf('://'); 56 var ind = title.indexOf('://');
57 if (ind >= 0) { 57 if (ind >= 0) {
58 title = title.substring(ind + 3); 58 title = title.substring(ind + 3);
59 } 59 }
60 } 60 }
61 // Since the direction is switched to RTL, punctuation symbols appear on the
62 // left side, that is wrong. So, just remove trailing punctuation symbols.
63 title = title.replace(/[^A-Za-z0-9]+$/, '');
61 return title; 64 return title;
62 } 65 }
63 66
64 /** 67 /**
65 * Helper function that creates an HTML element for displaying the origin of 68 * Helper function that creates an HTML element for displaying the origin of
66 * saved password. 69 * saved password.
67 * @param {Object} item A dictionary of data on the list item. 70 * @param {Object} item A dictionary of data on the list item.
68 * @param {Element} urlDiv div-element that will enclose the created 71 * @param {Element} urlDiv div-element that will enclose the created
69 * element. 72 * element.
70 * @return {Element} The element for displaying password origin. 73 * @return {Element} The element for displaying password origin.
71 */ 74 */
72 function createUrlLink(item, urlDiv) { 75 function createUrlLink(item, urlDiv) {
73 var urlLink; 76 var urlLink;
74 if (!item.isAndroidUri) { 77 if (!item.isAndroidUri) {
75 urlLink = item.ownerDocument.createElement('a'); 78 urlLink = item.ownerDocument.createElement('a');
76 urlLink.href = item.url; 79 urlLink.href = item.url;
77 urlLink.setAttribute('target', '_blank'); 80 urlLink.setAttribute('target', '_blank');
78 urlLink.dir = 'ltr'; 81 urlLink.textContent = item.shownUrl.split('').reverse().join('');
82
83 urlDiv.classList.add('left-elided-url');
79 } else { 84 } else {
80 urlLink = item.ownerDocument.createElement('span'); 85 urlLink = item.ownerDocument.createElement('span');
86 urlLink.textContent = item.shownUrl;
81 } 87 }
82 urlLink.textContent = item.shownUrl;
83 urlLink.addEventListener('focus', function() { 88 urlLink.addEventListener('focus', function() {
84 item.handleFocus(); 89 item.handleFocus();
85 }.bind(item)); 90 }.bind(item));
86 return urlLink; 91 return urlLink;
87 } 92 }
88 93
89 PasswordListItem.prototype = { 94 PasswordListItem.prototype = {
90 __proto__: DeletableItem.prototype, 95 __proto__: DeletableItem.prototype,
91 96
92 /** @override */ 97 /** @override */
93 decorate: function() { 98 decorate: function() {
94 DeletableItem.prototype.decorate.call(this); 99 DeletableItem.prototype.decorate.call(this);
95 100
96 // The URL of the site. 101 // The URL of the site.
97 var urlDiv = this.ownerDocument.createElement('div'); 102 var urlDiv = this.ownerDocument.createElement('div');
98 urlDiv.className = 'favicon-cell url'; 103 urlDiv.className = 'favicon-cell url';
99 urlDiv.setAttribute('title', getTitleForPasswordOrigin(this)); 104 urlDiv.setAttribute('title', getTitleForPasswordOrigin(this));
100 urlDiv.style.backgroundImage = getFaviconImageSet( 105 urlDiv.style.backgroundImage = getFaviconImageSet(
101 'origin/' + this.url, 16); 106 'origin/' + this.url, 16);
102 107
103 this.urlLink = createUrlLink(this, urlDiv); 108 this.urlLink = createUrlLink(this, urlDiv);
104 urlDiv.appendChild(this.urlLink); 109 urlDiv.appendChild(this.urlLink);
105 110
106 this.urlDiv = urlDiv;
107 this.contentElement.appendChild(urlDiv); 111 this.contentElement.appendChild(urlDiv);
108 112
109 // The stored username. 113 // The stored username.
110 var usernameDiv = this.ownerDocument.createElement('div'); 114 var usernameDiv = this.ownerDocument.createElement('div');
111 usernameDiv.className = 'name'; 115 usernameDiv.className = 'name';
112 usernameDiv.title = this.username; 116 usernameDiv.title = this.username;
113 this.contentElement.appendChild(usernameDiv); 117 this.contentElement.appendChild(usernameDiv);
114 var usernameInput = this.ownerDocument.createElement('input'); 118 var usernameInput = this.ownerDocument.createElement('input');
115 usernameInput.type = 'text'; 119 usernameInput.type = 'text';
116 usernameInput.className = 'inactive-item'; 120 usernameInput.className = 'inactive-item';
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 // The URL of the site. 366 // The URL of the site.
363 var urlDiv = this.ownerDocument.createElement('div'); 367 var urlDiv = this.ownerDocument.createElement('div');
364 urlDiv.className = 'favicon-cell url'; 368 urlDiv.className = 'favicon-cell url';
365 urlDiv.setAttribute('title', getTitleForPasswordOrigin(this)); 369 urlDiv.setAttribute('title', getTitleForPasswordOrigin(this));
366 urlDiv.style.backgroundImage = getFaviconImageSet( 370 urlDiv.style.backgroundImage = getFaviconImageSet(
367 'origin/' + this.url, 16); 371 'origin/' + this.url, 16);
368 372
369 this.urlLink = createUrlLink(this, urlDiv); 373 this.urlLink = createUrlLink(this, urlDiv);
370 urlDiv.appendChild(this.urlLink); 374 urlDiv.appendChild(this.urlLink);
371 375
372 this.urlDiv = urlDiv;
373 this.contentElement.appendChild(urlDiv); 376 this.contentElement.appendChild(urlDiv);
374 }, 377 },
375 378
376 /** @override */ 379 /** @override */
377 selectionChanged: function() { 380 selectionChanged: function() {
378 if (this.selected) { 381 if (this.selected) {
379 this.setFocusable_(true); 382 this.setFocusable_(true);
380 this.urlLink.focus(); 383 this.urlLink.focus();
381 } else { 384 } else {
382 this.setFocusable_(false); 385 this.setFocusable_(false);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 PasswordExceptionsList: PasswordExceptionsList, 558 PasswordExceptionsList: PasswordExceptionsList,
556 ORIGIN_FIELD: ORIGIN_FIELD, 559 ORIGIN_FIELD: ORIGIN_FIELD,
557 SHOWN_URL_FIELD: SHOWN_URL_FIELD, 560 SHOWN_URL_FIELD: SHOWN_URL_FIELD,
558 IS_SECURE_FIELD: IS_SECURE_FIELD, 561 IS_SECURE_FIELD: IS_SECURE_FIELD,
559 USERNAME_FIELD: USERNAME_FIELD, 562 USERNAME_FIELD: USERNAME_FIELD,
560 PASSWORD_FIELD: PASSWORD_FIELD, 563 PASSWORD_FIELD: PASSWORD_FIELD,
561 FEDERATION_FIELD: FEDERATION_FIELD, 564 FEDERATION_FIELD: FEDERATION_FIELD,
562 ORIGINAL_INDEX_FIELD: ORIGINAL_INDEX_FIELD 565 ORIGINAL_INDEX_FIELD: ORIGINAL_INDEX_FIELD
563 }; 566 };
564 }); 567 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/password_manager_list.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698