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 A simple message box screen implementation.
9 login
.createScreen('FatalErrorScreen', 'fatal-error', function() { return {
15 * Callback to run when the screen is dismissed.
21 * Saved UI states to restore when this screen hides.
27 decorate: function() {
28 $('fatal-error-dismiss-button').addEventListener(
29 'click', this.onDismiss_
.bind(this));
30 $('fatal-error-card').addEventListener(
31 'buttonclick', this.onDismiss_
.bind(this));
35 get defaultControl() {
36 if (Oobe
.isNewGaiaFlow()) {
37 return $('fatal-error-card').submitButton
;
39 return $('fatal-error-dismiss-button');
44 onBeforeShow: function() {
45 this.savedUIStates_
.progressDotHidden
= $('progress-dots').hidden
;
46 $('progress-dots').hidden
= true;
48 this.savedUIStates_
.headerHidden
= Oobe
.getInstance().headerHidden
;
49 Oobe
.getInstance().headerHidden
= true;
53 onBeforeHide: function() {
54 $('progress-dots').hidden
= this.savedUIStates_
.progressDotHidden
;
55 Oobe
.getInstance().headerHidden
= this.savedUIStates_
.headerHidden
;
59 * Invoked when user clicks on the ok button.
61 onDismiss_: function() {
66 * Shows the fatal error string screen.
67 * @param {string} message The error message to show.
68 * @param {function()} callback The callback to be invoked when the
69 * screen is dismissed.
71 show: function(message
, buttonLabel
, callback
) {
72 if (Oobe
.isNewGaiaFlow()) {
73 $('fatal-error-card').textContent
= message
;
74 $('fatal-error-card').buttonLabel
= buttonLabel
;
76 $('fatal-error-message').textContent
= message
;
78 this.callback_
= callback
;
79 Oobe
.showScreen({id
: SCREEN_FATAL_ERROR
});