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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
9 | 9 |
10 /** @constructor */ | 10 /** @constructor */ |
(...skipping 20 matching lines...) Expand all Loading... |
31 this.infobox = ''; | 31 this.infobox = ''; |
32 | 32 |
33 /** @type {?function():void} */ | 33 /** @type {?function():void} */ |
34 this.onTimeout = function() {}; | 34 this.onTimeout = function() {}; |
35 | 35 |
36 /** @type {string} */ | 36 /** @type {string} */ |
37 this.htmlFile = ''; | 37 this.htmlFile = ''; |
38 | 38 |
39 /** @type {string} */ | 39 /** @type {string} */ |
40 this.frame = ''; | 40 this.frame = ''; |
| 41 |
| 42 /** @type {boolean} */ |
| 43 this.showSpinner = false; |
41 }; | 44 }; |
42 | 45 |
43 /** | 46 /** |
44 * Create a new message window. | 47 * Create a new message window. |
45 * | 48 * |
46 * @param {remoting.MessageWindowOptions} options Message window create options | 49 * @param {remoting.MessageWindowOptions} options Message window create options |
47 * @constructor | 50 * @constructor |
48 */ | 51 */ |
49 remoting.MessageWindow = function(options) { | 52 remoting.MessageWindow = function(options) { |
50 var title = options.title; | 53 var title = options.title; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 151 } |
149 | 152 |
150 var message_struct = { | 153 var message_struct = { |
151 command: 'update_message', | 154 command: 'update_message', |
152 message: message | 155 message: message |
153 }; | 156 }; |
154 this.window_.postMessage(message_struct, '*'); | 157 this.window_.postMessage(message_struct, '*'); |
155 }; | 158 }; |
156 | 159 |
157 /** | 160 /** |
| 161 * Update the message being shown in the window to the given error message. |
| 162 * In addition to updating the message, any spinner is disabled and the |
| 163 * button text is changed to 'OK'. |
| 164 * This should only be called after the window has been shown. |
| 165 * |
| 166 * @param {string} message The message. |
| 167 */ |
| 168 remoting.MessageWindow.prototype.updateErrorMessage = function(message) { |
| 169 if (!this.window_) { |
| 170 this.pendingWindowOperations_.push(this.updateMessage.bind(this, message)); |
| 171 return; |
| 172 } |
| 173 |
| 174 var message_struct = { |
| 175 command: 'update_message', |
| 176 message: message, |
| 177 buttonLabel: chrome.i18n.getMessage(/*i18n-content*/'OK'), |
| 178 cancelButtonLabel: '', |
| 179 showSpinner: false |
| 180 }; |
| 181 this.window_.postMessage(message_struct, '*'); |
| 182 }; |
| 183 |
| 184 /** |
158 * Close the message box and unregister it with the window manager. | 185 * Close the message box and unregister it with the window manager. |
159 */ | 186 */ |
160 remoting.MessageWindow.prototype.close = function() { | 187 remoting.MessageWindow.prototype.close = function() { |
161 if (!this.window_) { | 188 if (!this.window_) { |
162 this.pendingWindowOperations_.push(this.close.bind(this)); | 189 this.pendingWindowOperations_.push(this.close.bind(this)); |
163 return; | 190 return; |
164 } | 191 } |
165 | 192 |
166 if (this.timer_) { | 193 if (this.timer_) { |
167 window.clearTimeout(this.timer_); | 194 window.clearTimeout(this.timer_); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 294 |
268 /** | 295 /** |
269 * Cancel the current connection and close all app windows. | 296 * Cancel the current connection and close all app windows. |
270 * | 297 * |
271 * @param {number} result The dialog result. | 298 * @param {number} result The dialog result. |
272 */ | 299 */ |
273 remoting.MessageWindow.quitApp = function(result) { | 300 remoting.MessageWindow.quitApp = function(result) { |
274 remoting.MessageWindowManager.closeAllMessageWindows(); | 301 remoting.MessageWindowManager.closeAllMessageWindows(); |
275 window.close(); | 302 window.close(); |
276 }; | 303 }; |
OLD | NEW |