1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 * @fileoverview Device disabled screen implementation.
9 login.createScreen('DeviceDisabledScreen', 'device-disabled', function() {
12 'setEnrollmentDomain',
17 * Ignore any accelerators the user presses on this screen.
19 ignoreAccelerators: true,
22 decorate: function() {
23 this.setEnrollmentDomain(null);
27 * The visibility of the cancel button in the header bar is controlled by a
28 * global. Although the device disabling screen hides the button, a
29 * notification intended for an earlier screen (e.g animation finished)
30 * could re-show the button. If this happens, the current screen's cancel()
31 * method will be shown when the user actually clicks the button. Make sure
32 * that this is a no-op.
38 * Event handler that is invoked just before the screen in shown.
40 onBeforeShow: function() {
41 $('progress-dots').hidden = true;
42 var headerBar = $('login-header-bar');
43 headerBar.allowCancel = false;
44 headerBar.showGuestButton = false;
45 headerBar.signinUIState = SIGNIN_UI_STATE.HIDDEN;
49 * Updates the explanation shown to the user. The explanation will indicate
50 * that the device is owned by |enrollment_domain|. If |enrollment_domain|
51 * is null or empty, a generic explanation will be used instead that does
52 * not reference any domain.
53 * @param {string} enrollment_domain The domain that owns the device.
55 setEnrollmentDomain: function(enrollment_domain) {
56 if (enrollment_domain) {
57 // The contents of |enrollment_domain| is untrusted. Set the resulting
58 // string as |textContent| so that it gets treated as plain text and
59 // cannot be used to inject JS or HTML.
60 $('device-disabled-explanation').textContent = loadTimeData.getStringF(
61 'deviceDisabledExplanationWithDomain',
64 $('device-disabled-explanation').textContent = loadTimeData.getString(
65 'deviceDisabledExplanationWithoutDomain');
71 * Sets the message to show to the user.
72 * @param {string} message The message to show to the user.
74 setMessage: function(message) {
75 // The contents of |message| is untrusted. Set it as |textContent| so that
76 // it gets treated as plain text and cannot be used to inject JS or HTML.
77 $('device-disabled-message').textContent = message;