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.
6 * @fileoverview A simple message box screen implementation.
9 login.createScreen('MessageBoxScreen', 'message-box', function() { return {
15 * Callback to run when the screen is dismissed.
21 * Ok button of the message box.
22 * @type {HTMLButtonElement}
27 * Saved hidden status of 'progress-dots'.
30 savedProgressDotsHidden_: null,
33 * Screen controls in bottom strip.
34 * @type {Array.<HTMLButtonElement>} Buttons to be put in the bottom strip.
39 this.okButton_ = this.ownerDocument.createElement('button');
40 this.okButton_.addEventListener('click', this.onDismiss_.bind(this));
41 buttons.push(this.okButton_);
46 get defaultControl() {
47 return this.okButton_;
51 * Invoked when user clicks on the ok button.
53 onDismiss_: function() {
55 $('progress-dots').hidden = this.savedProgressDotsHidden_;
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.
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;
72 Oobe.showScreen({id: SCREEN_MESSAGE_BOX});
74 this.savedProgressDotsHidden_ = $('progress-dots').hidden;
75 $('progress-dots').hidden = true;