Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 OptionsPage = options.OptionsPage; | 6 const OptionsPage = options.OptionsPage; |
| 7 const ArrayDataModel = cr.ui.ArrayDataModel; | 7 const ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 | 8 |
| 9 ///////////////////////////////////////////////////////////////////////////// | 9 ///////////////////////////////////////////////////////////////////////////// |
| 10 // PasswordManager class: | 10 // PasswordManager class: |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 /** | 146 /** |
| 147 * Updates the data model for the saved passwords list with the values from | 147 * Updates the data model for the saved passwords list with the values from |
| 148 * |entries|. | 148 * |entries|. |
| 149 * @param {Array} entries The list of saved password data. | 149 * @param {Array} entries The list of saved password data. |
| 150 */ | 150 */ |
| 151 setSavedPasswordsList_: function(entries) { | 151 setSavedPasswordsList_: function(entries) { |
| 152 if (this.lastQuery_) { | 152 if (this.lastQuery_) { |
| 153 // Implement password searching here in javascript, rather than in C++. | 153 // Implement password searching here in javascript, rather than in C++. |
| 154 // The number of saved passwords shouldn't be too big for us to handle. | 154 // The number of saved passwords shouldn't be too big for us to handle. |
| 155 var query = this.lastQuery_; | 155 var query = this.lastQuery_; |
| 156 var filter = function(entry) { | 156 var filter = function(entry, index, list) { |
|
James Hawkins
2011/06/28 01:27:18
|list| is unused?
Mike Mammarella
2011/06/28 01:30:27
Correct, but it's apparently passed so I included
James Hawkins
2011/06/28 01:31:22
Can't we not include it, like we did before?
Mike Mammarella
2011/06/28 01:34:19
We could, but I almost rewrote this by hand just b
| |
| 157 // Search both URL and username. | 157 // Search both URL and username. |
| 158 return entry[0].indexOf(query) >= 0 || entry[1].indexOf(query) >= 0; | 158 if (entry[0].indexOf(query) >= 0 || entry[1].indexOf(query) >= 0) { |
| 159 // Keep the original index so we can delete correctly. See also | |
| 160 // deleteItemAtIndex() in password_manager_list.js that uses this. | |
| 161 entry[3] = index; | |
| 162 return true; | |
| 163 } | |
| 164 return false; | |
| 159 }; | 165 }; |
| 160 entries = entries.filter(filter); | 166 entries = entries.filter(filter); |
| 161 } | 167 } |
| 162 this.savedPasswordsList_.dataModel = new ArrayDataModel(entries); | 168 this.savedPasswordsList_.dataModel = new ArrayDataModel(entries); |
| 163 this.updateListVisibility_(this.savedPasswordsList_); | 169 this.updateListVisibility_(this.savedPasswordsList_); |
| 164 }, | 170 }, |
| 165 | 171 |
| 166 /** | 172 /** |
| 167 * Updates the data model for the password exceptions list with the values | 173 * Updates the data model for the password exceptions list with the values |
| 168 * from |entries|. | 174 * from |entries|. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 PasswordManager.setPasswordExceptionsList = function(entries) { | 219 PasswordManager.setPasswordExceptionsList = function(entries) { |
| 214 PasswordManager.getInstance().setPasswordExceptionsList_(entries); | 220 PasswordManager.getInstance().setPasswordExceptionsList_(entries); |
| 215 }; | 221 }; |
| 216 | 222 |
| 217 // Export | 223 // Export |
| 218 return { | 224 return { |
| 219 PasswordManager: PasswordManager | 225 PasswordManager: PasswordManager |
| 220 }; | 226 }; |
| 221 | 227 |
| 222 }); | 228 }); |
| OLD | NEW |