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

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: Removed unused setters in PasswordExceptionsListItem and PasswordListItem. 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, 10) - 179 parseInt(computedStyle.webkitMarginStart, 10) -
180 parseInt(computedStyle.webkitPaddingStart, 10); 180 parseInt(computedStyle.webkitPaddingStart, 10);
181 for (var i = 0; i < entries.length; ++i) { 181 for (var i = 0; i < entries.length; ++i) {
182 var urlLink = entries[i].urlLink; 182 entry = entries[i];
183 if (entries[i].isAndroidUri || urlLink.offsetWidth <= columnWidth) 183 // For android://com.example, elide from the right.
184 if (!entry.isClickable)
185 continue;
186 var cellWidth = columnWidth;
187 if (entry.androidUriSuffix)
188 cellWidth -= entry.androidUriSuffix.offsetWidth;
189
190 var urlLink = entry.urlLink;
191 if (urlLink.offsetWidth <= cellWidth)
184 continue; 192 continue;
185 urlLink.textContent = '…' + urlLink.textContent.substring(1); 193 urlLink.textContent = '…' + urlLink.textContent.substring(1);
186 while (urlLink.offsetWidth > columnWidth) 194 while (urlLink.offsetWidth > cellWidth)
187 urlLink.textContent = '…' + urlLink.textContent.substring(2); 195 urlLink.textContent = '…' + urlLink.textContent.substring(2);
188 } 196 }
189 }, 197 },
190 198
191 /** 199 /**
192 * Updates the data model for the saved passwords list with the values from 200 * Updates the data model for the saved passwords list with the values from
193 * |entries|. 201 * |entries|.
194 * @param {!Array} entries The list of saved password data. 202 * @param {!Array} entries The list of saved password data.
195 */ 203 */
196 setSavedPasswordsList_: function(entries) { 204 setSavedPasswordsList_: function(entries) {
197 if (this.lastQuery_) { 205 if (this.lastQuery_) {
198 // Implement password searching here in javascript, rather than in C++. 206 // 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. 207 // The number of saved passwords shouldn't be too big for us to handle.
200 var query = this.lastQuery_; 208 var query = this.lastQuery_;
201 var filter = function(entry, index, list) { 209 var filter = function(entry, index, list) {
202 // Search both shown URL and username. 210 // Search both shown URL and username.
203 var shownUrl = entry[options.passwordManager.SHOWN_URL_FIELD]; 211 var shownOrigin = entry[options.passwordManager.SHOWN_ORIGIN_FIELD];
204 var username = entry[options.passwordManager.USERNAME_FIELD]; 212 var username = entry[options.passwordManager.USERNAME_FIELD];
205 if (shownUrl.toLowerCase().indexOf(query.toLowerCase()) >= 0 || 213 if (shownOrigin.toLowerCase().indexOf(query.toLowerCase()) >= 0 ||
206 username.toLowerCase().indexOf(query.toLowerCase()) >= 0) { 214 username.toLowerCase().indexOf(query.toLowerCase()) >= 0) {
207 // Keep the original index so we can delete correctly. See also 215 // Keep the original index so we can delete correctly. See also
208 // deleteItemAtIndex() in password_manager_list.js that uses this. 216 // deleteItemAtIndex() in password_manager_list.js that uses this.
209 entry[options.passwordManager.ORIGINAL_INDEX_FIELD] = index; 217 entry[options.passwordManager.ORIGINAL_INDEX_FIELD] = index;
210 return true; 218 return true;
211 } 219 }
212 return false; 220 return false;
213 }; 221 };
214 entries = entries.filter(filter); 222 entries = entries.filter(filter);
215 } 223 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 'setPasswordExceptionsList', 296 'setPasswordExceptionsList',
289 'showPassword' 297 'showPassword'
290 ]); 298 ]);
291 299
292 // Export 300 // Export
293 return { 301 return {
294 PasswordManager: PasswordManager 302 PasswordManager: PasswordManager
295 }; 303 };
296 304
297 }); 305 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698