OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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.passwordsExceptions', function() { | 5 cr.define('options.passwordManager', function() { |
6 | 6 |
7 const List = cr.ui.List; | 7 const List = cr.ui.List; |
8 const ListItem = cr.ui.ListItem; | 8 const ListItem = cr.ui.ListItem; |
9 const ArrayDataModel = cr.ui.ArrayDataModel; | 9 const ArrayDataModel = cr.ui.ArrayDataModel; |
10 | 10 |
11 /** | 11 /** |
12 * Creates a new passwords list item. | 12 * Creates a new passwords list item. |
13 * @param {Array} entry A pair of the form [url, username]. | 13 * @param {Array} entry A pair of the form [url, username]. |
14 * @constructor | 14 * @constructor |
15 * @extends {cr.ui.ListItem} | 15 * @extends {cr.ui.ListItem} |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 clear: function() { | 153 clear: function() { |
154 this.dataModel = new ArrayDataModel([]); | 154 this.dataModel = new ArrayDataModel([]); |
155 this.listArea.updateButtonSensitivity(); | 155 this.listArea.updateButtonSensitivity(); |
156 }, | 156 }, |
157 | 157 |
158 /** | 158 /** |
159 * Remove selected row from browser's model. | 159 * Remove selected row from browser's model. |
160 */ | 160 */ |
161 removeSelectedRow: function() { | 161 removeSelectedRow: function() { |
162 var selectedIndex = this.selectionModel.selectedIndex; | 162 var selectedIndex = this.selectionModel.selectedIndex; |
163 PasswordsExceptions.removeSavedPassword(selectedIndex); | 163 PasswordManager.removeSavedPassword(selectedIndex); |
164 }, | 164 }, |
165 | 165 |
166 showSelectedPassword: function() { | 166 showSelectedPassword: function() { |
167 var selectedIndex = this.selectionModel.selectedIndex; | 167 var selectedIndex = this.selectionModel.selectedIndex; |
168 PasswordsExceptions.showSelectedPassword(selectedIndex); | 168 PasswordManager.showSelectedPassword(selectedIndex); |
169 }, | 169 }, |
170 | 170 |
171 /** | 171 /** |
172 * The length of the list. | 172 * The length of the list. |
173 */ | 173 */ |
174 get length() { | 174 get length() { |
175 return this.dataModel.length; | 175 return this.dataModel.length; |
176 }, | 176 }, |
177 }; | 177 }; |
178 | 178 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 clear: function() { | 217 clear: function() { |
218 this.dataModel = new ArrayDataModel([]); | 218 this.dataModel = new ArrayDataModel([]); |
219 this.listArea.updateButtonSensitivity(); | 219 this.listArea.updateButtonSensitivity(); |
220 }, | 220 }, |
221 | 221 |
222 /** | 222 /** |
223 * Remove selected row from browser's model. | 223 * Remove selected row from browser's model. |
224 */ | 224 */ |
225 removeSelectedRow: function() { | 225 removeSelectedRow: function() { |
226 var selectedIndex = this.selectionModel.selectedIndex; | 226 var selectedIndex = this.selectionModel.selectedIndex; |
227 PasswordsExceptions.removePasswordException(selectedIndex); | 227 PasswordManager.removePasswordException(selectedIndex); |
228 }, | 228 }, |
229 | 229 |
230 /** | 230 /** |
231 * The length of the list. | 231 * The length of the list. |
232 */ | 232 */ |
233 get length() { | 233 get length() { |
234 return this.dataModel.length; | 234 return this.dataModel.length; |
235 }, | 235 }, |
236 }; | 236 }; |
237 | 237 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 removeRow.onclick = function(event) { | 277 removeRow.onclick = function(event) { |
278 self.passwordsList.removeSelectedRow(); | 278 self.passwordsList.removeSelectedRow(); |
279 }; | 279 }; |
280 | 280 |
281 removeAll.onclick = function(event) { | 281 removeAll.onclick = function(event) { |
282 AlertOverlay.show( | 282 AlertOverlay.show( |
283 undefined, | 283 undefined, |
284 localStrings.getString('passwordsRemoveAllWarning'), | 284 localStrings.getString('passwordsRemoveAllWarning'), |
285 localStrings.getString('yesButtonLabel'), | 285 localStrings.getString('yesButtonLabel'), |
286 localStrings.getString('noButtonLabel'), | 286 localStrings.getString('noButtonLabel'), |
287 function() { PasswordsExceptions.removeAllPasswords(); }); | 287 function() { PasswordManager.removeAllPasswords(); }); |
288 }; | 288 }; |
289 | 289 |
290 showHidePassword.onclick = function(event) { | 290 showHidePassword.onclick = function(event) { |
291 if(self.showingPassword) { | 291 if(self.showingPassword) { |
292 self.passwordLabel.textContent = ""; | 292 self.passwordLabel.textContent = ""; |
293 this.textContent = templateData.passwordsShowButton; | 293 this.textContent = templateData.passwordsShowButton; |
294 } else { | 294 } else { |
295 self.passwordsList.showSelectedPassword(); | 295 self.passwordsList.showSelectedPassword(); |
296 this.textContent = templateData.passwordsHideButton; | 296 this.textContent = templateData.passwordsHideButton; |
297 } | 297 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 removeAll.textContent = templateData.passwordsRemoveAllButton; | 355 removeAll.textContent = templateData.passwordsRemoveAllButton; |
356 this.appendChild(removeAll); | 356 this.appendChild(removeAll); |
357 this.removeAll = removeAll; | 357 this.removeAll = removeAll; |
358 | 358 |
359 var self = this; | 359 var self = this; |
360 removeRow.onclick = function(event) { | 360 removeRow.onclick = function(event) { |
361 self.passwordExceptionsList.removeSelectedRow(); | 361 self.passwordExceptionsList.removeSelectedRow(); |
362 }; | 362 }; |
363 | 363 |
364 removeAll.onclick = function(event) { | 364 removeAll.onclick = function(event) { |
365 PasswordsExceptions.removeAllPasswordExceptions(); | 365 PasswordManager.removeAllPasswordExceptions(); |
366 }; | 366 }; |
367 | 367 |
368 this.updateButtonSensitivity(); | 368 this.updateButtonSensitivity(); |
369 }, | 369 }, |
370 | 370 |
371 /** | 371 /** |
372 * Update the button's states | 372 * Update the button's states |
373 */ | 373 */ |
374 updateButtonSensitivity: function() { | 374 updateButtonSensitivity: function() { |
375 var selectionSize = this.passwordExceptionsList.selectedItems.length; | 375 var selectionSize = this.passwordExceptionsList.selectedItems.length; |
(...skipping 14 matching lines...) Expand all Loading... |
390 | 390 |
391 return { | 391 return { |
392 PasswordsListItem: PasswordsListItem, | 392 PasswordsListItem: PasswordsListItem, |
393 PasswordExceptionsListItem: PasswordExceptionsListItem, | 393 PasswordExceptionsListItem: PasswordExceptionsListItem, |
394 PasswordsList: PasswordsList, | 394 PasswordsList: PasswordsList, |
395 PasswordExceptionsList: PasswordExceptionsList, | 395 PasswordExceptionsList: PasswordExceptionsList, |
396 PasswordsListArea: PasswordsListArea, | 396 PasswordsListArea: PasswordsListArea, |
397 PasswordExceptionsListArea: PasswordExceptionsListArea | 397 PasswordExceptionsListArea: PasswordExceptionsListArea |
398 }; | 398 }; |
399 }); | 399 }); |
OLD | NEW |