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 23 matching lines...) Expand all Loading... |
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 | 41 |
42 /** @type {number} */ | 42 /** @type {number} */ |
43 this.minimumWidth = 0; | 43 this.minimumWidth = 0; |
44 | |
45 /** @type {boolean} */ | |
46 this.showSpinner = false; | |
47 }; | 44 }; |
48 | 45 |
49 /** | 46 /** |
50 * Create a new message window. | 47 * Create a new message window. |
51 * | 48 * |
52 * @param {remoting.MessageWindowOptions} options Message window create options | 49 * @param {remoting.MessageWindowOptions} options Message window create options |
53 * @constructor | 50 * @constructor |
54 */ | 51 */ |
55 remoting.MessageWindow = function(options) { | 52 remoting.MessageWindow = function(options) { |
56 var title = options.title; | 53 var title = options.title; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 * | 144 * |
148 * @param {string} message The message. | 145 * @param {string} message The message. |
149 */ | 146 */ |
150 remoting.MessageWindow.prototype.updateMessage = function(message) { | 147 remoting.MessageWindow.prototype.updateMessage = function(message) { |
151 if (!this.window_) { | 148 if (!this.window_) { |
152 this.pendingWindowOperations_.push(this.updateMessage.bind(this, message)); | 149 this.pendingWindowOperations_.push(this.updateMessage.bind(this, message)); |
153 return; | 150 return; |
154 } | 151 } |
155 | 152 |
156 var message_struct = { | 153 var message_struct = { |
157 command: 'update', | 154 command: 'update_message', |
158 message: message | 155 message: message |
159 }; | 156 }; |
160 this.window_.postMessage(message_struct, '*'); | 157 this.window_.postMessage(message_struct, '*'); |
161 }; | 158 }; |
162 | |
163 /** | |
164 * Update the message being shown in the window to the given error message. | |
165 * In addition to updating the message, any spinner is disabled and the | |
166 * button text is changed to 'OK'. | |
167 * This should only be called after the window has been shown. | |
168 * | |
169 * @param {string} message The message. | |
170 */ | |
171 remoting.MessageWindow.prototype.updateErrorMessage = function(message) { | |
172 if (!this.window_) { | |
173 this.pendingWindowOperations_.push(this.updateMessage.bind(this, message)); | |
174 return; | |
175 } | |
176 | |
177 var message_struct = { | |
178 command: 'update', | |
179 message: message, | |
180 buttonLabel: chrome.i18n.getMessage(/*i18n-content*/'OK'), | |
181 cancelButtonLabel: '', | |
182 showSpinner: false | |
183 }; | |
184 this.window_.postMessage(message_struct, '*'); | |
185 }; | |
186 | 159 |
187 /** | 160 /** |
188 * Close the message box and unregister it with the window manager. | 161 * Close the message box and unregister it with the window manager. |
189 */ | 162 */ |
190 remoting.MessageWindow.prototype.close = function() { | 163 remoting.MessageWindow.prototype.close = function() { |
191 if (!this.window_) { | 164 if (!this.window_) { |
192 this.pendingWindowOperations_.push(this.close.bind(this)); | 165 this.pendingWindowOperations_.push(this.close.bind(this)); |
193 return; | 166 return; |
194 } | 167 } |
195 | 168 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 270 |
298 /** | 271 /** |
299 * Cancel the current connection and close all app windows. | 272 * Cancel the current connection and close all app windows. |
300 * | 273 * |
301 * @param {number} result The dialog result. | 274 * @param {number} result The dialog result. |
302 */ | 275 */ |
303 remoting.MessageWindow.quitApp = function(result) { | 276 remoting.MessageWindow.quitApp = function(result) { |
304 remoting.MessageWindowManager.closeAllMessageWindows(); | 277 remoting.MessageWindowManager.closeAllMessageWindows(); |
305 window.close(); | 278 window.close(); |
306 }; | 279 }; |
OLD | NEW |