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

Unified Diff: chrome/browser/resources/options/managed_user_set_passphrase.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: A few more fixes. Created 7 years, 10 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_set_passphrase.js
diff --git a/chrome/browser/resources/options/managed_user_set_passphrase.js b/chrome/browser/resources/options/managed_user_set_passphrase.js
new file mode 100644
index 0000000000000000000000000000000000000000..bd96f264f2ba0173cdd654d6f76486819e52e984
--- /dev/null
+++ b/chrome/browser/resources/options/managed_user_set_passphrase.js
@@ -0,0 +1,79 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('options', function() {
+ /** @const */ var OptionsPage = options.OptionsPage;
+
+ //////////////////////////////////////////////////////////////////////////////
+ // ManagedUserSetPassphraseOverlay class:
+
+ /**
+ * Encapsulated handling of the Managed User Set Passphrase page.
+ * @constructor
+ */
+ function ManagedUserSetPassphraseOverlay() {
+ OptionsPage.call(
+ this,
+ 'setPassphrase',
+ loadTimeData.getString('setPassphraseTitle'),
+ 'managed-user-set-passphrase-overlay');
+ }
+
+ cr.addSingletonGetter(ManagedUserSetPassphraseOverlay);
+
+ ManagedUserSetPassphraseOverlay.prototype = {
+ __proto__: OptionsPage.prototype,
+
+ /** @override */
+ initializePage: function() {
+ OptionsPage.prototype.initializePage.call(this);
+ $('managed-user-passphrase').oninput = this.updateDisplay_;
+ $('passphrase-confirm').oninput = this.updateDisplay_;
+
+ $('save-passphrase').onclick = function() {
+ chrome.send('setPassphrase', [$('managed-user-passphrase').value]);
+ $('managed-user-passphrase').value = '';
+ $('passphrase-confirm').value = '';
+ OptionsPage.closeOverlay();
+ };
+ },
+ updateDisplay_: function() {
+ var valid =
+ $('passphrase-confirm').value == $('managed-user-passphrase').value;
+ $('passphrase-mismatch').hidden = valid;
+ $('passphrase-confirm').setCustomValidity(
+ valid ? '' : $('passphrase-mismatch').textContent);
+ $('save-passphrase').disabled =
+ !$('passphrase-confirm').validity.valid ||
+ !$('managed-user-passphrase').validity.valid;
+ },
+ /** @override */
+ canShowPage: function() {
+ return ManagedUserSettings.getInstance().canShowPage();
+ },
+ };
+
+ // This is a class used for browsertests.
+ function ManagedUserSetPassphraseForTesting() {
Bernhard Bauer 2013/02/05 16:21:32 This can really just be an object.
Adrian Kuegel 2013/02/05 16:53:04 Done.
+ this.getPassphraseInput = function() {
+ return $('managed-user-passphrase');
+ };
+ this.getPassphraseConfirmInput = function() {
+ return $('passphrase-confirm');
+ };
+ this.getSavePassphraseButton = function() {
+ return $('save-passphrase');
+ };
+ this.updateDisplay = function() {
+ return ManagedUserSetPassphraseOverlay.getInstance().updateDisplay_();
+ };
+ }
+
+ // Export
+ return {
+ ManagedUserSetPassphraseOverlay: ManagedUserSetPassphraseOverlay,
+ ManagedUserSetPassphraseForTesting: ManagedUserSetPassphraseForTesting
+ };
+
+});

Powered by Google App Engine
This is Rietveld 408576698