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

Unified Diff: chrome/browser/resources/options/managed_user_set_passphrase.js

Issue 12208068: Add a set passphrase dialog for managed user accounts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error on linux_clang. 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..9db2e8db90c05d9281dec0d3c9562d6ceaa47732
--- /dev/null
+++ b/chrome/browser/resources/options/managed_user_set_passphrase.js
@@ -0,0 +1,75 @@
+// Copyright (c) 2013 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;
+ },
+ };
+
+ // This is a class used for browsertests.
+ var ManagedUserSetPassphraseForTesting = {
+ getPassphraseInput: function() {
+ return $('managed-user-passphrase');
+ },
+ getPassphraseConfirmInput: function() {
+ return $('passphrase-confirm');
+ },
+ getSavePassphraseButton: function() {
+ return $('save-passphrase');
+ },
+ updateDisplay: function() {
+ return ManagedUserSetPassphraseOverlay.getInstance().updateDisplay_();
+ }
+ };
+
+ // Export
+ return {
+ ManagedUserSetPassphraseOverlay: ManagedUserSetPassphraseOverlay,
+ ManagedUserSetPassphraseForTesting: ManagedUserSetPassphraseForTesting
+ };
+
+});

Powered by Google App Engine
This is Rietveld 408576698