OLD | NEW |
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 * |entries|. | 169 * |entries|. |
170 * @param {!Array} entries The list of saved password data. | 170 * @param {!Array} entries The list of saved password data. |
171 */ | 171 */ |
172 setSavedPasswordsList_: function(entries) { | 172 setSavedPasswordsList_: function(entries) { |
173 if (this.lastQuery_) { | 173 if (this.lastQuery_) { |
174 // Implement password searching here in javascript, rather than in C++. | 174 // Implement password searching here in javascript, rather than in C++. |
175 // The number of saved passwords shouldn't be too big for us to handle. | 175 // The number of saved passwords shouldn't be too big for us to handle. |
176 var query = this.lastQuery_; | 176 var query = this.lastQuery_; |
177 var filter = function(entry, index, list) { | 177 var filter = function(entry, index, list) { |
178 // Search both shown URL and username. | 178 // Search both shown URL and username. |
179 var shownUrl = entry[options.passwordManager.SHOWN_URL_FIELD]; | 179 var shownOrigin = entry[options.passwordManager.SHOWN_ORIGIN_FIELD]; |
180 var username = entry[options.passwordManager.USERNAME_FIELD]; | 180 var username = entry[options.passwordManager.USERNAME_FIELD]; |
181 if (shownUrl.toLowerCase().indexOf(query.toLowerCase()) >= 0 || | 181 if (shownOrigin.toLowerCase().indexOf(query.toLowerCase()) >= 0 || |
182 username.toLowerCase().indexOf(query.toLowerCase()) >= 0) { | 182 username.toLowerCase().indexOf(query.toLowerCase()) >= 0) { |
183 // Keep the original index so we can delete correctly. See also | 183 // Keep the original index so we can delete correctly. See also |
184 // deleteItemAtIndex() in password_manager_list.js that uses this. | 184 // deleteItemAtIndex() in password_manager_list.js that uses this. |
185 entry[options.passwordManager.ORIGINAL_INDEX_FIELD] = index; | 185 entry[options.passwordManager.ORIGINAL_INDEX_FIELD] = index; |
186 return true; | 186 return true; |
187 } | 187 } |
188 return false; | 188 return false; |
189 }; | 189 }; |
190 entries = entries.filter(filter); | 190 entries = entries.filter(filter); |
191 } | 191 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 'setPasswordExceptionsList', | 258 'setPasswordExceptionsList', |
259 'showPassword' | 259 'showPassword' |
260 ]); | 260 ]); |
261 | 261 |
262 // Export | 262 // Export |
263 return { | 263 return { |
264 PasswordManager: PasswordManager | 264 PasswordManager: PasswordManager |
265 }; | 265 }; |
266 | 266 |
267 }); | 267 }); |
OLD | NEW |