Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: chrome/browser/resources/options/password_manager.js

Issue 1193143003: Enable import/export of passwords into/from Password Manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 initializePage: function() { 59 initializePage: function() {
60 Page.prototype.initializePage.call(this); 60 Page.prototype.initializePage.call(this);
61 61
62 $('auto-signin-block').hidden = 62 $('auto-signin-block').hidden =
63 !loadTimeData.getBoolean('enableCredentialManagerAPI'); 63 !loadTimeData.getBoolean('enableCredentialManagerAPI');
64 64
65 $('password-manager-confirm').onclick = function() { 65 $('password-manager-confirm').onclick = function() {
66 PageManager.closeOverlay(); 66 PageManager.closeOverlay();
67 }; 67 };
68 68
69 $('password-manager-import').onclick = function() {
70 chrome.send('importPassword');
71 };
72
73 $('password-manager-export').onclick = function() {
74 chrome.send('exportPassword');
75 };
76
69 $('password-search-box').addEventListener('search', 77 $('password-search-box').addEventListener('search',
70 this.handleSearchQueryChange_.bind(this)); 78 this.handleSearchQueryChange_.bind(this));
71 79
72 $('exceptions-learn-more').onclick = function() { 80 $('exceptions-learn-more').onclick = function() {
73 chrome.send('coreOptionsUserMetricsAction', 81 chrome.send('coreOptionsUserMetricsAction',
74 ['Options_PasswordManagerExceptionsLearnMore']); 82 ['Options_PasswordManagerExceptionsLearnMore']);
75 return true; // Always follow the href 83 return true; // Always follow the href
76 }; 84 };
77 85
78 this.createSavedPasswordsList_(); 86 this.createSavedPasswordsList_();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 index = i; 271 index = i;
264 break; 272 break;
265 } 273 }
266 } 274 }
267 } 275 }
268 276
269 // Reveal the password in the UI. 277 // Reveal the password in the UI.
270 var item = this.savedPasswordsList_.getListItemByIndex(index); 278 var item = this.savedPasswordsList_.getListItemByIndex(index);
271 item.showPassword(password); 279 item.showPassword(password);
272 }, 280 },
281
282 /**
283 * @param {boolean} visible Whether the link should be visible.
284 * @private
285 */
286 setManageAccountLinkVisibility_: function(visible) {
287 $('manage-passwords-span').hidden = !visible;
288 },
289
290 showImportExportButton_: function() {
Finnur 2016/04/18 14:25:46 This fails the Closure compile: ## /media/largedr
vabr (Chromium) 2016/04/19 12:43:10 This was fixed by dbeam@ in https://codereview.chr
291 $('password-manager-import').hidden = false;
292 $('password-manager-export').hidden = false;
293 },
273 }; 294 };
274 295
275 /** 296 /**
276 * Removes a saved password. 297 * Removes a saved password.
277 * @param {number} rowIndex indicating the row to remove. 298 * @param {number} rowIndex indicating the row to remove.
278 */ 299 */
279 PasswordManager.removeSavedPassword = function(rowIndex) { 300 PasswordManager.removeSavedPassword = function(rowIndex) {
280 chrome.send('removeSavedPassword', [String(rowIndex)]); 301 chrome.send('removeSavedPassword', [String(rowIndex)]);
281 chrome.send('coreOptionsUserMetricsAction', 302 chrome.send('coreOptionsUserMetricsAction',
282 ['Options_PasswordManagerDeletePassword']); 303 ['Options_PasswordManagerDeletePassword']);
283 }; 304 };
284 305
285 /** 306 /**
286 * Removes a password exception. 307 * Removes a password exception.
287 * @param {number} rowIndex indicating the row to remove. 308 * @param {number} rowIndex indicating the row to remove.
288 */ 309 */
289 PasswordManager.removePasswordException = function(rowIndex) { 310 PasswordManager.removePasswordException = function(rowIndex) {
290 chrome.send('removePasswordException', [String(rowIndex)]); 311 chrome.send('removePasswordException', [String(rowIndex)]);
291 }; 312 };
292 313
293 PasswordManager.requestShowPassword = function(index) { 314 PasswordManager.requestShowPassword = function(index) {
294 chrome.send('requestShowPassword', [index]); 315 chrome.send('requestShowPassword', [index]);
295 }; 316 };
296 317
297 // Forward public APIs to private implementations on the singleton instance. 318 // Forward public APIs to private implementations on the singleton instance.
298 cr.makePublic(PasswordManager, [ 319 cr.makePublic(PasswordManager, [
299 'setSavedPasswordsList', 320 'setSavedPasswordsList',
300 'setPasswordExceptionsList', 321 'setPasswordExceptionsList',
301 'showPassword' 322 'showImportExportButton',
323 'showPassword',
302 ]); 324 ]);
303 325
304 // Export 326 // Export
305 return { 327 return {
306 PasswordManager: PasswordManager 328 PasswordManager: PasswordManager
307 }; 329 };
308 330
309 }); 331 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698