| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // (Mac, Linux), so we delay this operation until the page is shown. | 81 // (Mac, Linux), so we delay this operation until the page is shown. |
| 82 chrome.send('updatePasswordLists'); | 82 chrome.send('updatePasswordLists'); |
| 83 $('password-search-box').focus(); | 83 $('password-search-box').focus(); |
| 84 }, | 84 }, |
| 85 | 85 |
| 86 /** | 86 /** |
| 87 * Creates, decorates and initializes the saved passwords list. | 87 * Creates, decorates and initializes the saved passwords list. |
| 88 * @private | 88 * @private |
| 89 */ | 89 */ |
| 90 createSavedPasswordsList_: function() { | 90 createSavedPasswordsList_: function() { |
| 91 this.savedPasswordsList_ = $('saved-passwords-list'); | 91 var savedPasswordsList = $('saved-passwords-list'); |
| 92 options.passwordManager.PasswordsList.decorate(this.savedPasswordsList_); | 92 options.passwordManager.PasswordsList.decorate(savedPasswordsList); |
| 93 this.savedPasswordsList_ = assertInstanceof(savedPasswordsList, |
| 94 options.DeletableItemList); |
| 93 this.savedPasswordsList_.autoExpands = true; | 95 this.savedPasswordsList_.autoExpands = true; |
| 94 }, | 96 }, |
| 95 | 97 |
| 96 /** | 98 /** |
| 97 * Creates, decorates and initializes the password exceptions list. | 99 * Creates, decorates and initializes the password exceptions list. |
| 98 * @private | 100 * @private |
| 99 */ | 101 */ |
| 100 createPasswordExceptionsList_: function() { | 102 createPasswordExceptionsList_: function() { |
| 101 this.passwordExceptionsList_ = $('password-exceptions-list'); | 103 var passwordExceptionsList = $('password-exceptions-list'); |
| 102 options.passwordManager.PasswordExceptionsList.decorate( | 104 options.passwordManager.PasswordExceptionsList.decorate( |
| 103 this.passwordExceptionsList_); | 105 passwordExceptionsList); |
| 106 this.passwordExceptionsList_ = assertInstanceof(passwordExceptionsList, |
| 107 options.DeletableItemList); |
| 104 this.passwordExceptionsList_.autoExpands = true; | 108 this.passwordExceptionsList_.autoExpands = true; |
| 105 }, | 109 }, |
| 106 | 110 |
| 107 /** | 111 /** |
| 108 * Handles search query changes. | 112 * Handles search query changes. |
| 109 * @param {!Event} e The event object. | 113 * @param {!Event} e The event object. |
| 110 * @private | 114 * @private |
| 111 */ | 115 */ |
| 112 handleSearchQueryChange_: function(e) { | 116 handleSearchQueryChange_: function(e) { |
| 113 if (this.queryDelayTimerId_) | 117 if (this.queryDelayTimerId_) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 144 updateListVisibility_: function(list) { | 148 updateListVisibility_: function(list) { |
| 145 var empty = list.dataModel.length == 0; | 149 var empty = list.dataModel.length == 0; |
| 146 var listPlaceHolderID = list.id + '-empty-placeholder'; | 150 var listPlaceHolderID = list.id + '-empty-placeholder'; |
| 147 list.hidden = empty; | 151 list.hidden = empty; |
| 148 $(listPlaceHolderID).hidden = !empty; | 152 $(listPlaceHolderID).hidden = !empty; |
| 149 }, | 153 }, |
| 150 | 154 |
| 151 /** | 155 /** |
| 152 * Updates the data model for the saved passwords list with the values from | 156 * Updates the data model for the saved passwords list with the values from |
| 153 * |entries|. | 157 * |entries|. |
| 154 * @param {Array} entries The list of saved password data. | 158 * @param {!Array} entries The list of saved password data. |
| 155 */ | 159 */ |
| 156 setSavedPasswordsList_: function(entries) { | 160 setSavedPasswordsList_: function(entries) { |
| 157 if (this.lastQuery_) { | 161 if (this.lastQuery_) { |
| 158 // Implement password searching here in javascript, rather than in C++. | 162 // Implement password searching here in javascript, rather than in C++. |
| 159 // The number of saved passwords shouldn't be too big for us to handle. | 163 // The number of saved passwords shouldn't be too big for us to handle. |
| 160 var query = this.lastQuery_; | 164 var query = this.lastQuery_; |
| 161 var filter = function(entry, index, list) { | 165 var filter = function(entry, index, list) { |
| 162 // Search both URL and username. | 166 // Search both URL and username. |
| 163 if (entry[0].toLowerCase().indexOf(query.toLowerCase()) >= 0 || | 167 if (entry[0].toLowerCase().indexOf(query.toLowerCase()) >= 0 || |
| 164 entry[1].toLowerCase().indexOf(query.toLowerCase()) >= 0) { | 168 entry[1].toLowerCase().indexOf(query.toLowerCase()) >= 0) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 'setPasswordExceptionsList', | 241 'setPasswordExceptionsList', |
| 238 'showPassword' | 242 'showPassword' |
| 239 ]); | 243 ]); |
| 240 | 244 |
| 241 // Export | 245 // Export |
| 242 return { | 246 return { |
| 243 PasswordManager: PasswordManager | 247 PasswordManager: PasswordManager |
| 244 }; | 248 }; |
| 245 | 249 |
| 246 }); | 250 }); |
| OLD | NEW |