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

Side by Side Diff: chrome/browser/resources/options/password_manager.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 unified diff | Download patch
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', function() { 5 cr.define('options', function() {
6 /** @const */ var Page = cr.ui.pageManager.Page; 6 /** @const */ var Page = cr.ui.pageManager.Page;
7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager;
8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
9 9
10 ///////////////////////////////////////////////////////////////////////////// 10 /////////////////////////////////////////////////////////////////////////////
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 */ 171 */
172 updateOriginsEliding_: function(list) { 172 updateOriginsEliding_: function(list) {
173 var entries = list.getElementsByClassName('deletable-item'); 173 var entries = list.getElementsByClassName('deletable-item');
174 if (entries.length == 0) 174 if (entries.length == 0)
175 return; 175 return;
176 var entry = entries[0]; 176 var entry = entries[0];
177 var computedStyle = window.getComputedStyle(entry.urlDiv); 177 var computedStyle = window.getComputedStyle(entry.urlDiv);
178 var columnWidth = entry.urlDiv.offsetWidth - 178 var columnWidth = entry.urlDiv.offsetWidth -
179 parseInt(computedStyle.webkitMarginStart) - 179 parseInt(computedStyle.webkitMarginStart) -
180 parseInt(computedStyle.webkitPaddingStart); 180 parseInt(computedStyle.webkitPaddingStart);
181
181 for (var i = 0; i < entries.length; ++i) { 182 for (var i = 0; i < entries.length; ++i) {
182 var urlLink = entries[i].urlLink; 183 entry = entries[i];
183 if (entries[i].isAndroidUri || urlLink.offsetWidth <= columnWidth) 184 // For android://com.example, elide from the right.
185 if (!entry.isClickable)
186 continue;
187 var cellWidth = columnWidth;
188 if (entry.androidSpan)
189 cellWidth -= entry.androidSpan.offsetWidth;
190
191 var urlLink = entry.urlLink;
192 if (urlLink.offsetWidth <= cellWidth)
184 continue; 193 continue;
185 urlLink.textContent = '…' + urlLink.textContent.substring(1); 194 urlLink.textContent = '…' + urlLink.textContent.substring(1);
186 while (urlLink.offsetWidth > columnWidth) 195 while (urlLink.offsetWidth > cellWidth)
187 urlLink.textContent = '…' + urlLink.textContent.substring(2); 196 urlLink.textContent = '…' + urlLink.textContent.substring(2);
188 } 197 }
189 }, 198 },
190 199
191 /** 200 /**
192 * Updates the data model for the saved passwords list with the values from 201 * Updates the data model for the saved passwords list with the values from
193 * |entries|. 202 * |entries|.
194 * @param {!Array} entries The list of saved password data. 203 * @param {!Array} entries The list of saved password data.
195 */ 204 */
196 setSavedPasswordsList_: function(entries) { 205 setSavedPasswordsList_: function(entries) {
197 if (this.lastQuery_) { 206 if (this.lastQuery_) {
198 // Implement password searching here in javascript, rather than in C++. 207 // Implement password searching here in javascript, rather than in C++.
199 // The number of saved passwords shouldn't be too big for us to handle. 208 // The number of saved passwords shouldn't be too big for us to handle.
200 var query = this.lastQuery_; 209 var query = this.lastQuery_;
201 var filter = function(entry, index, list) { 210 var filter = function(entry, index, list) {
202 // Search both shown URL and username. 211 // Search both shown URL and username.
203 var shownUrl = entry[options.passwordManager.SHOWN_URL_FIELD]; 212 var shownOrigin = entry[options.passwordManager.SHOWN_ORIGIN_FIELD];
204 var username = entry[options.passwordManager.USERNAME_FIELD]; 213 var username = entry[options.passwordManager.USERNAME_FIELD];
205 if (shownUrl.toLowerCase().indexOf(query.toLowerCase()) >= 0 || 214 if (shownOrigin.toLowerCase().indexOf(query.toLowerCase()) >= 0 ||
206 username.toLowerCase().indexOf(query.toLowerCase()) >= 0) { 215 username.toLowerCase().indexOf(query.toLowerCase()) >= 0) {
207 // Keep the original index so we can delete correctly. See also 216 // Keep the original index so we can delete correctly. See also
208 // deleteItemAtIndex() in password_manager_list.js that uses this. 217 // deleteItemAtIndex() in password_manager_list.js that uses this.
209 entry[options.passwordManager.ORIGINAL_INDEX_FIELD] = index; 218 entry[options.passwordManager.ORIGINAL_INDEX_FIELD] = index;
210 return true; 219 return true;
211 } 220 }
212 return false; 221 return false;
213 }; 222 };
214 entries = entries.filter(filter); 223 entries = entries.filter(filter);
215 } 224 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 'setPasswordExceptionsList', 293 'setPasswordExceptionsList',
285 'showPassword' 294 'showPassword'
286 ]); 295 ]);
287 296
288 // Export 297 // Export
289 return { 298 return {
290 PasswordManager: PasswordManager 299 PasswordManager: PasswordManager
291 }; 300 };
292 301
293 }); 302 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698