| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 /** | 5 /** |
| 6 * @fileoverview Device disabled screen implementation. | 6 * @fileoverview Device disabled screen implementation. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 login.createScreen('DeviceDisabledScreen', 'device-disabled', function() { | 9 login.createScreen('DeviceDisabledScreen', 'device-disabled', function() { |
| 10 return { | 10 return { |
| 11 EXTERNAL_API: [ | 11 EXTERNAL_API: ['setEnrollmentDomain', 'setMessage'], |
| 12 'setEnrollmentDomain', | |
| 13 'setMessage' | |
| 14 ], | |
| 15 | 12 |
| 16 /** | 13 /** |
| 17 * Ignore any accelerators the user presses on this screen. | 14 * Ignore any accelerators the user presses on this screen. |
| 18 */ | 15 */ |
| 19 ignoreAccelerators: true, | 16 ignoreAccelerators: true, |
| 20 | 17 |
| 21 /** @override */ | 18 /** @override */ |
| 22 decorate: function() { | 19 decorate: function() { |
| 23 this.setEnrollmentDomain(null); | 20 this.setEnrollmentDomain(null); |
| 24 }, | 21 }, |
| 25 | 22 |
| 26 /** | 23 /** |
| 27 * The visibility of the cancel button in the header bar is controlled by a | 24 * 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 | 25 * global. Although the device disabling screen hides the button, a |
| 29 * notification intended for an earlier screen (e.g animation finished) | 26 * notification intended for an earlier screen (e.g animation finished) |
| 30 * could re-show the button. If this happens, the current screen's cancel() | 27 * 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 | 28 * method will be shown when the user actually clicks the button. Make sure |
| 32 * that this is a no-op. | 29 * that this is a no-op. |
| 33 */ | 30 */ |
| 34 cancel: function() { | 31 cancel: function() {}, |
| 35 }, | |
| 36 | 32 |
| 37 /** | 33 /** |
| 38 * Event handler that is invoked just before the screen in shown. | 34 * Event handler that is invoked just before the screen in shown. |
| 39 */ | 35 */ |
| 40 onBeforeShow: function() { | 36 onBeforeShow: function() { |
| 41 $('progress-dots').hidden = true; | 37 $('progress-dots').hidden = true; |
| 42 var headerBar = $('login-header-bar'); | 38 var headerBar = $('login-header-bar'); |
| 43 headerBar.allowCancel = false; | 39 headerBar.allowCancel = false; |
| 44 headerBar.showGuestButton = false; | 40 headerBar.showGuestButton = false; |
| 45 headerBar.signinUIState = SIGNIN_UI_STATE.HIDDEN; | 41 headerBar.signinUIState = SIGNIN_UI_STATE.HIDDEN; |
| 46 }, | 42 }, |
| 47 | 43 |
| 48 /** | 44 /** |
| 49 * Updates the explanation shown to the user. The explanation will indicate | 45 * Updates the explanation shown to the user. The explanation will indicate |
| 50 * that the device is owned by |enrollment_domain|. If |enrollment_domain| | 46 * 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 | 47 * is null or empty, a generic explanation will be used instead that does |
| 52 * not reference any domain. | 48 * not reference any domain. |
| 53 * @param {string} enrollment_domain The domain that owns the device. | 49 * @param {string} enrollment_domain The domain that owns the device. |
| 54 */ | 50 */ |
| 55 setEnrollmentDomain: function(enrollment_domain) { | 51 setEnrollmentDomain: function(enrollment_domain) { |
| 56 if (enrollment_domain) { | 52 if (enrollment_domain) { |
| 57 // The contents of |enrollment_domain| is untrusted. Set the resulting | 53 // The contents of |enrollment_domain| is untrusted. Set the resulting |
| 58 // string as |textContent| so that it gets treated as plain text and | 54 // string as |textContent| so that it gets treated as plain text and |
| 59 // cannot be used to inject JS or HTML. | 55 // cannot be used to inject JS or HTML. |
| 60 $('device-disabled-explanation').textContent = loadTimeData.getStringF( | 56 $('device-disabled-explanation').textContent = loadTimeData.getStringF( |
| 61 'deviceDisabledExplanationWithDomain', | 57 'deviceDisabledExplanationWithDomain', enrollment_domain); |
| 62 enrollment_domain); | |
| 63 } else { | 58 } else { |
| 64 $('device-disabled-explanation').textContent = loadTimeData.getString( | 59 $('device-disabled-explanation').textContent = |
| 65 'deviceDisabledExplanationWithoutDomain'); | 60 loadTimeData.getString('deviceDisabledExplanationWithoutDomain'); |
| 66 } | 61 } |
| 67 }, | 62 }, |
| 68 | 63 |
| 69 | 64 |
| 70 /** | 65 /** |
| 71 * Sets the message to show to the user. | 66 * Sets the message to show to the user. |
| 72 * @param {string} message The message to show to the user. | 67 * @param {string} message The message to show to the user. |
| 73 */ | 68 */ |
| 74 setMessage: function(message) { | 69 setMessage: function(message) { |
| 75 // The contents of |message| is untrusted. Set it as |textContent| so that | 70 // 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. | 71 // it gets treated as plain text and cannot be used to inject JS or HTML. |
| 77 $('device-disabled-message').textContent = message; | 72 $('device-disabled-message').textContent = message; |
| 78 } | 73 } |
| 79 }; | 74 }; |
| 80 }); | 75 }); |
| OLD | NEW |