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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/options/managed_user_settings.js
diff --git a/chrome/browser/resources/options/managed_user_settings.js b/chrome/browser/resources/options/managed_user_settings.js
index 04322632128ed069927a43cefe3698e8e90cd0f4..bc13f2821e2568c424c41842b8b4aaf433a20683 100644
--- a/chrome/browser/resources/options/managed_user_settings.js
+++ b/chrome/browser/resources/options/managed_user_settings.js
@@ -28,12 +28,15 @@ cr.define('options', function() {
ManagedUserSettings.prototype = {
// Inherit from OptionsPage.
__proto__: OptionsPage.prototype,
+ authenticationChecked: false,
+ authenticationChecking: false,
/**
* Initialize the page.
* @override
*/
initializePage: function() {
+ var self = this;
// Call base class implementation to start preference initialization.
OptionsPage.prototype.initializePage.call(this);
@@ -42,13 +45,52 @@ cr.define('options', function() {
};
$('managed-user-settings-confirm').onclick = function() {
- OptionsPage.closeOverlay();
+ if ($('use-passphrase-checkbox').checked) {
+ chrome.send('isPassphraseSet');
+ } else {
+ OptionsPage.closeOverlay();
+ }
};
$('set-passphrase').onclick = function() {
- // TODO(bauerb): Set passphrase
+ OptionsPage.navigateToPage('setPassphrase');
};
},
+ /** @override */
+ canShowPage: function() {
+ if (this.authenticationChecked)
+ return true;
+ if (!this.authenticationChecking) {
+ chrome.send('displayPassphraseDialog',
+ ['ManagedUserSettings.isAuthenticated']);
+ this.authenticationChecking = true;
+ }
+ return false;
+ },
+ didClosePage: function() {
+ // Reset the authentication of the custodian.
+ this.authenticationChecked = false;
+ chrome.send('endAuthentication');
+ },
+ };
+
+ ManagedUserSettings.isAuthenticated = function(success) {
+ var instance = ManagedUserSettings.getInstance();
+ if (success) {
+ instance.authenticationChecked = true;
+ OptionsPage.navigateToPage('managedUser');
+ } else {
+ OptionsPage.closeOverlay();
+ }
+ instance.authenticationChecking = false;
+ };
+
+ ManagedUserSettings.isPassphraseSet = function(success) {
+ if (success) {
+ OptionsPage.closeOverlay();
+ } else {
+ OptionsPage.navigateToPage('setPassphrase');
+ }
};
// Export

Powered by Google App Engine
This is Rietveld 408576698