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

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: Inlined the variable androidUriSuffix Created 4 years, 8 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, 10) - 179 parseInt(computedStyle.webkitMarginStart, 10) -
180 parseInt(computedStyle.webkitPaddingStart, 10); 180 parseInt(computedStyle.webkitPaddingStart, 10);
181 if (columnWidth <= 0) {
182 console.error('Estimated column width <= 0. Skip origins eliding.');
183 return;
184 }
185 for (var i = 0; i < entries.length; ++i) { 181 for (var i = 0; i < entries.length; ++i) {
186 var urlLink = entries[i].urlLink; 182 entry = entries[i];
187 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 var urlLink = entry.urlLink;
190 if (cellWidth <= 0) {
191 console.error('cellWidth <= 0. Skip origins eliding for ' +
192 urlLink.textContent);
193 continue;
194 }
195 if (urlLink.offsetWidth <= cellWidth)
188 continue; 196 continue;
189 urlLink.textContent = '…' + urlLink.textContent.substring(1); 197 urlLink.textContent = '…' + urlLink.textContent.substring(1);
190 while (urlLink.offsetWidth > columnWidth) 198 while (urlLink.offsetWidth > cellWidth)
191 urlLink.textContent = '…' + urlLink.textContent.substring(2); 199 urlLink.textContent = '…' + urlLink.textContent.substring(2);
192 } 200 }
193 }, 201 },
194 202
195 /** 203 /**
196 * Updates the data model for the saved passwords list with the values from 204 * Updates the data model for the saved passwords list with the values from
197 * |entries|. 205 * |entries|.
198 * @param {!Array} entries The list of saved password data. 206 * @param {!Array} entries The list of saved password data.
199 */ 207 */
200 setSavedPasswordsList_: function(entries) { 208 setSavedPasswordsList_: function(entries) {
201 if (this.lastQuery_) { 209 if (this.lastQuery_) {
202 // Implement password searching here in javascript, rather than in C++. 210 // Implement password searching here in javascript, rather than in C++.
203 // The number of saved passwords shouldn't be too big for us to handle. 211 // The number of saved passwords shouldn't be too big for us to handle.
204 var query = this.lastQuery_; 212 var query = this.lastQuery_;
205 var filter = function(entry, index, list) { 213 var filter = function(entry, index, list) {
206 // Search both shown URL and username. 214 // Search both shown URL and username.
207 var shownUrl = entry[options.passwordManager.SHOWN_URL_FIELD]; 215 var shownOrigin = entry[options.passwordManager.SHOWN_ORIGIN_FIELD];
208 var username = entry[options.passwordManager.USERNAME_FIELD]; 216 var username = entry[options.passwordManager.USERNAME_FIELD];
209 if (shownUrl.toLowerCase().indexOf(query.toLowerCase()) >= 0 || 217 if (shownOrigin.toLowerCase().indexOf(query.toLowerCase()) >= 0 ||
210 username.toLowerCase().indexOf(query.toLowerCase()) >= 0) { 218 username.toLowerCase().indexOf(query.toLowerCase()) >= 0) {
211 // Keep the original index so we can delete correctly. See also 219 // Keep the original index so we can delete correctly. See also
212 // deleteItemAtIndex() in password_manager_list.js that uses this. 220 // deleteItemAtIndex() in password_manager_list.js that uses this.
213 entry[options.passwordManager.ORIGINAL_INDEX_FIELD] = index; 221 entry[options.passwordManager.ORIGINAL_INDEX_FIELD] = index;
214 return true; 222 return true;
215 } 223 }
216 return false; 224 return false;
217 }; 225 };
218 entries = entries.filter(filter); 226 entries = entries.filter(filter);
219 } 227 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 'setPasswordExceptionsList', 300 'setPasswordExceptionsList',
293 'showPassword' 301 'showPassword'
294 ]); 302 ]);
295 303
296 // Export 304 // Export
297 return { 305 return {
298 PasswordManager: PasswordManager 306 PasswordManager: PasswordManager
299 }; 307 };
300 308
301 }); 309 });
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/resources/options/password_manager_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698