| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 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. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview A simple message box screen implementation. | |
| 7 */ | |
| 8 | |
| 9 login.createScreen('MessageBoxScreen', 'message-box', function() { return { | |
| 10 EXTERNAL_API: [ | |
| 11 'show' | |
| 12 ], | |
| 13 | |
| 14 /** | |
| 15 * Callback to run when the screen is dismissed. | |
| 16 * @type {function()} | |
| 17 */ | |
| 18 callback_: null, | |
| 19 | |
| 20 /** | |
| 21 * Ok button of the message box. | |
| 22 * @type {HTMLButtonElement} | |
| 23 */ | |
| 24 okButton_: null, | |
| 25 | |
| 26 /** | |
| 27 * Saved hidden status of 'progress-dots'. | |
| 28 * @type {boolean} | |
| 29 */ | |
| 30 savedProgressDotsHidden_: null, | |
| 31 | |
| 32 /** | |
| 33 * Screen controls in bottom strip. | |
| 34 * @type {Array.<HTMLButtonElement>} Buttons to be put in the bottom strip. | |
| 35 */ | |
| 36 get buttons() { | |
| 37 var buttons = []; | |
| 38 | |
| 39 this.okButton_ = this.ownerDocument.createElement('button'); | |
| 40 this.okButton_.addEventListener('click', this.onDismiss_.bind(this)); | |
| 41 buttons.push(this.okButton_); | |
| 42 | |
| 43 return buttons; | |
| 44 }, | |
| 45 | |
| 46 get defaultControl() { | |
| 47 return this.okButton_; | |
| 48 }, | |
| 49 | |
| 50 /** | |
| 51 * Invoked when user clicks on the ok button. | |
| 52 */ | |
| 53 onDismiss_: function() { | |
| 54 this.callback_(); | |
| 55 $('progress-dots').hidden = this.savedProgressDotsHidden_; | |
| 56 }, | |
| 57 | |
| 58 /** | |
| 59 * Shows the no password warning screen. | |
| 60 * @param {string} title Title string of the message box. | |
| 61 * @param {string} message Body text of the message box. | |
| 62 * @param {string} okLabel Label text for the okay button. | |
| 63 * @param {function()} callback The callback to be invoked when the | |
| 64 * screen is dismissed. | |
| 65 */ | |
| 66 show: function(title, message, okLabel, callback) { | |
| 67 $('message-box-title').textContent = title; | |
| 68 $('message-box-body').textContent = message; | |
| 69 this.okButton_.textContent = okLabel; | |
| 70 this.callback_ = callback; | |
| 71 | |
| 72 Oobe.showScreen({id: SCREEN_MESSAGE_BOX}); | |
| 73 | |
| 74 this.savedProgressDotsHidden_ = $('progress-dots').hidden; | |
| 75 $('progress-dots').hidden = true; | |
| 76 } | |
| 77 }; | |
| 78 }); | |
| OLD | NEW |