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

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: Removed import-complete dialog. Created 4 years, 9 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
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));
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 index = i; 231 index = i;
222 break; 232 break;
223 } 233 }
224 } 234 }
225 } 235 }
226 236
227 // Reveal the password in the UI. 237 // Reveal the password in the UI.
228 var item = this.savedPasswordsList_.getListItemByIndex(index); 238 var item = this.savedPasswordsList_.getListItemByIndex(index);
229 item.showPassword(password); 239 item.showPassword(password);
230 }, 240 },
241
242 /**
243 * @param {boolean} visible Whether the link should be visible.
244 * @private
245 */
246 setManageAccountLinkVisibility_: function(visible) {
247 $('manage-passwords-span').hidden = !visible;
248 },
249
250 showImportExportButton_: function() {
251 $('password-manager-import').disabled = false;
252 $('password-manager-export').disabled = false;
253 },
231 }; 254 };
232 255
233 /** 256 /**
234 * Removes a saved password. 257 * Removes a saved password.
235 * @param {number} rowIndex indicating the row to remove. 258 * @param {number} rowIndex indicating the row to remove.
236 */ 259 */
237 PasswordManager.removeSavedPassword = function(rowIndex) { 260 PasswordManager.removeSavedPassword = function(rowIndex) {
238 chrome.send('removeSavedPassword', [String(rowIndex)]); 261 chrome.send('removeSavedPassword', [String(rowIndex)]);
239 chrome.send('coreOptionsUserMetricsAction', 262 chrome.send('coreOptionsUserMetricsAction',
240 ['Options_PasswordManagerDeletePassword']); 263 ['Options_PasswordManagerDeletePassword']);
241 }; 264 };
242 265
243 /** 266 /**
244 * Removes a password exception. 267 * Removes a password exception.
245 * @param {number} rowIndex indicating the row to remove. 268 * @param {number} rowIndex indicating the row to remove.
246 */ 269 */
247 PasswordManager.removePasswordException = function(rowIndex) { 270 PasswordManager.removePasswordException = function(rowIndex) {
248 chrome.send('removePasswordException', [String(rowIndex)]); 271 chrome.send('removePasswordException', [String(rowIndex)]);
249 }; 272 };
250 273
251 PasswordManager.requestShowPassword = function(index) { 274 PasswordManager.requestShowPassword = function(index) {
252 chrome.send('requestShowPassword', [index]); 275 chrome.send('requestShowPassword', [index]);
253 }; 276 };
254 277
255 // Forward public APIs to private implementations on the singleton instance. 278 // Forward public APIs to private implementations on the singleton instance.
256 cr.makePublic(PasswordManager, [ 279 cr.makePublic(PasswordManager, [
257 'setSavedPasswordsList', 280 'setSavedPasswordsList',
258 'setPasswordExceptionsList', 281 'setPasswordExceptionsList',
259 'showPassword' 282 'showPassword',
283 'setImportCompleteUiVisibility',
284 'showImportExportButton'
260 ]); 285 ]);
261 286
262 // Export 287 // Export
263 return { 288 return {
264 PasswordManager: PasswordManager 289 PasswordManager: PasswordManager
265 }; 290 };
266 291
267 }); 292 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698