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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 * The most recent search query, or null if the query is empty. | 52 * The most recent search query, or null if the query is empty. |
53 * @type {?string} | 53 * @type {?string} |
54 * @private | 54 * @private |
55 */ | 55 */ |
56 lastQuery_: null, | 56 lastQuery_: null, |
57 | 57 |
58 /** @override */ | 58 /** @override */ |
59 initializePage: function() { | 59 initializePage: function() { |
60 Page.prototype.initializePage.call(this); | 60 Page.prototype.initializePage.call(this); |
61 | 61 |
62 var self = this; | |
Evan Stade
2016/04/06 21:25:22
is this used somewhere?
xunlu
2016/04/08 15:38:21
Done.
| |
63 | |
62 $('auto-signin-block').hidden = | 64 $('auto-signin-block').hidden = |
63 !loadTimeData.getBoolean('enableCredentialManagerAPI'); | 65 !loadTimeData.getBoolean('enableCredentialManagerAPI'); |
64 | 66 |
65 $('password-manager-confirm').onclick = function() { | 67 $('password-manager-confirm').onclick = function() { |
66 PageManager.closeOverlay(); | 68 PageManager.closeOverlay(); |
67 }; | 69 }; |
68 | 70 |
71 $('password-manager-import').onclick = function() { | |
72 chrome.send('importPassword'); | |
73 }; | |
74 | |
75 $('password-manager-export').onclick = function() { | |
76 chrome.send('exportPassword'); | |
77 }; | |
78 | |
69 $('password-search-box').addEventListener('search', | 79 $('password-search-box').addEventListener('search', |
70 this.handleSearchQueryChange_.bind(this)); | 80 this.handleSearchQueryChange_.bind(this)); |
Evan Stade
2016/04/06 21:25:22
seems like the indentation was correct before
xunlu
2016/04/08 15:38:21
Done.
| |
71 | 81 |
72 $('exceptions-learn-more').onclick = function() { | 82 $('exceptions-learn-more').onclick = function() { |
73 chrome.send('coreOptionsUserMetricsAction', | 83 chrome.send('coreOptionsUserMetricsAction', |
74 ['Options_PasswordManagerExceptionsLearnMore']); | 84 ['Options_PasswordManagerExceptionsLearnMore']); |
75 return true; // Always follow the href | 85 return true; // Always follow the href |
76 }; | 86 }; |
77 | 87 |
78 this.createSavedPasswordsList_(); | 88 this.createSavedPasswordsList_(); |
79 this.createPasswordExceptionsList_(); | 89 this.createPasswordExceptionsList_(); |
80 }, | 90 }, |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 index = i; | 273 index = i; |
264 break; | 274 break; |
265 } | 275 } |
266 } | 276 } |
267 } | 277 } |
268 | 278 |
269 // Reveal the password in the UI. | 279 // Reveal the password in the UI. |
270 var item = this.savedPasswordsList_.getListItemByIndex(index); | 280 var item = this.savedPasswordsList_.getListItemByIndex(index); |
271 item.showPassword(password); | 281 item.showPassword(password); |
272 }, | 282 }, |
283 | |
284 /** | |
285 * @param {boolean} visible Whether the link should be visible. | |
286 * @private | |
287 */ | |
288 setManageAccountLinkVisibility_: function(visible) { | |
289 $('manage-passwords-span').hidden = !visible; | |
290 }, | |
291 | |
292 showImportExportButton_: function() { | |
293 $('password-manager-import').disabled = false; | |
294 $('password-manager-export').disabled = false; | |
295 }, | |
273 }; | 296 }; |
274 | 297 |
275 /** | 298 /** |
276 * Removes a saved password. | 299 * Removes a saved password. |
277 * @param {number} rowIndex indicating the row to remove. | 300 * @param {number} rowIndex indicating the row to remove. |
278 */ | 301 */ |
279 PasswordManager.removeSavedPassword = function(rowIndex) { | 302 PasswordManager.removeSavedPassword = function(rowIndex) { |
280 chrome.send('removeSavedPassword', [String(rowIndex)]); | 303 chrome.send('removeSavedPassword', [String(rowIndex)]); |
281 chrome.send('coreOptionsUserMetricsAction', | 304 chrome.send('coreOptionsUserMetricsAction', |
282 ['Options_PasswordManagerDeletePassword']); | 305 ['Options_PasswordManagerDeletePassword']); |
Evan Stade
2016/04/06 21:25:22
I think this indent needs to change too
xunlu
2016/04/08 15:38:21
Done.
| |
283 }; | 306 }; |
284 | 307 |
285 /** | 308 /** |
286 * Removes a password exception. | 309 * Removes a password exception. |
287 * @param {number} rowIndex indicating the row to remove. | 310 * @param {number} rowIndex indicating the row to remove. |
288 */ | 311 */ |
289 PasswordManager.removePasswordException = function(rowIndex) { | 312 PasswordManager.removePasswordException = function(rowIndex) { |
290 chrome.send('removePasswordException', [String(rowIndex)]); | 313 chrome.send('removePasswordException', [String(rowIndex)]); |
291 }; | 314 }; |
292 | 315 |
293 PasswordManager.requestShowPassword = function(index) { | 316 PasswordManager.requestShowPassword = function(index) { |
294 chrome.send('requestShowPassword', [index]); | 317 chrome.send('requestShowPassword', [index]); |
295 }; | 318 }; |
296 | 319 |
297 // Forward public APIs to private implementations on the singleton instance. | 320 // Forward public APIs to private implementations on the singleton instance. |
298 cr.makePublic(PasswordManager, [ | 321 cr.makePublic(PasswordManager, [ |
299 'setSavedPasswordsList', | 322 'setSavedPasswordsList', |
300 'setPasswordExceptionsList', | 323 'setPasswordExceptionsList', |
301 'showPassword' | 324 'showPassword', |
325 'showImportExportButton' | |
Evan Stade
2016/04/06 21:25:22
nit: add a final comma
nit 2: alphabetize
xunlu
2016/04/08 15:38:21
Done.
| |
302 ]); | 326 ]); |
303 | 327 |
304 // Export | 328 // Export |
305 return { | 329 return { |
306 PasswordManager: PasswordManager | 330 PasswordManager: PasswordManager |
307 }; | 331 }; |
308 | 332 |
309 }); | 333 }); |
OLD | NEW |