OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 A simple message box screen implementation. | 6 * @fileoverview A simple message box screen implementation. |
7 */ | 7 */ |
8 | 8 |
9 login.createScreen('MessageBoxScreen', 'message-box', function() { return { | 9 login.createScreen('FatalErrorScreen', 'fatal-error', function() { return { |
10 EXTERNAL_API: [ | 10 EXTERNAL_API: [ |
11 'show' | 11 'show' |
12 ], | 12 ], |
13 | 13 |
14 /** | 14 /** |
15 * Callback to run when the screen is dismissed. | 15 * Callback to run when the screen is dismissed. |
16 * @type {function()} | 16 * @type {function()} |
17 */ | 17 */ |
18 callback_: null, | 18 callback_: null, |
19 | 19 |
20 /** | 20 /** |
21 * Ok button of the message box. | |
22 * @type {HTMLButtonElement} | |
23 */ | |
24 okButton_: null, | |
25 | |
26 /** | |
27 * Saved hidden status of 'progress-dots'. | 21 * Saved hidden status of 'progress-dots'. |
28 * @type {boolean} | 22 * @type {boolean} |
29 */ | 23 */ |
30 savedProgressDotsHidden_: null, | 24 savedProgressDotsHidden_: null, |
31 | 25 |
32 /** | 26 /** @override */ |
33 * Screen controls in bottom strip. | 27 decorate: function() { |
34 * @type {Array.<HTMLButtonElement>} Buttons to be put in the bottom strip. | 28 $('fatal-error-dismiss-button').addEventListener( |
35 */ | 29 'click', this.onDismiss_.bind(this)); |
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 }, | 30 }, |
45 | 31 |
46 get defaultControl() { | 32 get defaultControl() { |
47 return this.okButton_; | 33 return $('fatal-error-dismiss-button'); |
48 }, | 34 }, |
49 | 35 |
50 /** | 36 /** |
51 * Invoked when user clicks on the ok button. | 37 * Invoked when user clicks on the ok button. |
52 */ | 38 */ |
53 onDismiss_: function() { | 39 onDismiss_: function() { |
54 this.callback_(); | 40 this.callback_(); |
55 $('progress-dots').hidden = this.savedProgressDotsHidden_; | 41 $('progress-dots').hidden = this.savedProgressDotsHidden_; |
56 }, | 42 }, |
57 | 43 |
58 /** | 44 /** |
59 * Shows the no password warning screen. | 45 * 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 | 46 * @param {function()} callback The callback to be invoked when the |
64 * screen is dismissed. | 47 * screen is dismissed. |
65 */ | 48 */ |
66 show: function(title, message, okLabel, callback) { | 49 show: function(callback) { |
67 $('message-box-title').textContent = title; | 50 Oobe.getInstance().headerHidden = true; |
Nikita (slow)
2014/02/06 05:08:25
nit: When does this header will be restored if we
xiyuan
2014/02/06 05:46:05
Right now it is okay because we always go back to
| |
68 $('message-box-body').textContent = message; | |
69 this.okButton_.textContent = okLabel; | |
70 this.callback_ = callback; | 51 this.callback_ = callback; |
71 | 52 |
72 Oobe.showScreen({id: SCREEN_MESSAGE_BOX}); | 53 Oobe.showScreen({id: SCREEN_FATAL_ERROR}); |
73 | 54 |
74 this.savedProgressDotsHidden_ = $('progress-dots').hidden; | 55 this.savedProgressDotsHidden_ = $('progress-dots').hidden; |
75 $('progress-dots').hidden = true; | 56 $('progress-dots').hidden = true; |
76 } | 57 } |
77 }; | 58 }; |
78 }); | 59 }); |
OLD | NEW |