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

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

Issue 11783008: Add a lock to the managed user settings page and require authentication for unlocking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a check if the passphrase is set before closing the settings. Created 7 years, 11 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 | Annotate | Revision Log
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 if (loadTimeData.getBoolean('managedUsersEnabled')) { 5 if (loadTimeData.getBoolean('managedUsersEnabled')) {
6 6
7 cr.define('options', function() { 7 cr.define('options', function() {
8 /** @const */ var OptionsPage = options.OptionsPage; 8 /** @const */ var OptionsPage = options.OptionsPage;
9 9
10 ////////////////////////////////////////////////////////////////////////////// 10 //////////////////////////////////////////////////////////////////////////////
(...skipping 10 matching lines...) Expand all
21 'manageduser', 21 'manageduser',
22 loadTimeData.getString('managedUserSettingsPageTabTitle'), 22 loadTimeData.getString('managedUserSettingsPageTabTitle'),
23 'managed-user-settings-page'); 23 'managed-user-settings-page');
24 } 24 }
25 25
26 cr.addSingletonGetter(ManagedUserSettings); 26 cr.addSingletonGetter(ManagedUserSettings);
27 27
28 ManagedUserSettings.prototype = { 28 ManagedUserSettings.prototype = {
29 // Inherit from OptionsPage. 29 // Inherit from OptionsPage.
30 __proto__: OptionsPage.prototype, 30 __proto__: OptionsPage.prototype,
31 authenticationChecked: false,
32 authenticationChecking: false,
31 33
32 /** 34 /**
33 * Initialize the page. 35 * Initialize the page.
34 * @override 36 * @override
35 */ 37 */
36 initializePage: function() { 38 initializePage: function() {
39 var self = this;
37 // Call base class implementation to start preference initialization. 40 // Call base class implementation to start preference initialization.
38 OptionsPage.prototype.initializePage.call(this); 41 OptionsPage.prototype.initializePage.call(this);
39 42
40 $('get-content-packs-button').onclick = function(event) { 43 $('get-content-packs-button').onclick = function(event) {
41 window.open(loadTimeData.getString('getContentPacksURL')); 44 window.open(loadTimeData.getString('getContentPacksURL'));
42 }; 45 };
43 46
44 $('managed-user-settings-confirm').onclick = function() { 47 $('managed-user-settings-confirm').onclick = function() {
45 OptionsPage.closeOverlay(); 48 if ($('use-passphrase-checkbox').checked) {
49 chrome.send('isPassphraseSet');
50 } else {
51 OptionsPage.closeOverlay();
52 }
46 }; 53 };
47 54
48 $('set-passphrase').onclick = function() { 55 $('set-passphrase').onclick = function() {
49 // TODO(bauerb): Set passphrase 56 OptionsPage.navigateToPage('setPassphrase');
50 }; 57 };
51 }, 58 },
59 /** @override */
60 canShowPage: function() {
61 if (this.authenticationChecked)
62 return true;
63 if (!this.authenticationChecking) {
64 chrome.send('displayPassphraseDialog',
65 ['ManagedUserSettings.isAuthenticated']);
66 this.authenticationChecking = true;
67 }
68 return false;
69 },
70 didClosePage: function() {
71 // Reset the authentication of the custodian.
72 this.authenticationChecked = false;
73 chrome.send('endAuthentication');
74 },
52 }; 75 };
53 76
77 ManagedUserSettings.isAuthenticated = function(success) {
78 var instance = ManagedUserSettings.getInstance();
79 if (success) {
80 instance.authenticationChecked = true;
81 OptionsPage.navigateToPage('managedUser');
82 } else {
83 OptionsPage.closeOverlay();
84 }
85 instance.authenticationChecking = false;
86 };
87
88 ManagedUserSettings.isPassphraseSet = function(success) {
89 if (success) {
90 OptionsPage.closeOverlay();
91 } else {
92 OptionsPage.navigateToPage('setPassphrase');
93 }
94 };
95
54 // Export 96 // Export
55 return { 97 return {
56 ManagedUserSettings: ManagedUserSettings 98 ManagedUserSettings: ManagedUserSettings
57 }; 99 };
58 }); 100 });
59 101
60 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698