Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: remoting/webapp/base/js/message_window_helper.js

Issue 803653004: Update Chromoting to use /third_party/closure_compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Define Entry for browser_tests Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 */
11 remoting.MessageWindowOptions = function() {
12 /** @type {string} */
13 this.title = '';
14
15 /** @type {string} */
16 this.message = '';
17
18 /** @type {string} */
19 this.buttonLabel = '';
20
21 /** @type {string} */
22 this.cancelButtonLabel = '';
23
24 /** @type {function(number):void} */
25 this.onResult = function() {};
26
27 /** @type {number} */
28 this.duration = 0;
29
30 /** @type {string} */
31 this.infobox = '';
32
33 /** @type {?function():void} */
34 this.onTimeout = function() {};
35 };
36
10 /** 37 /**
11 * Create a new message window. 38 * Create a new message window.
12 * 39 *
13 * @param {Object} options Message window create options 40 * @param {remoting.MessageWindowOptions} options Message window create options
14 * @constructor 41 * @constructor
15 */ 42 */
16 remoting.MessageWindow = function(options) { 43 remoting.MessageWindow = function(options) {
17 var title = /** @type {string} */ (options.title); 44 var title = options.title;
18 var message = /** @type {string} */ (options.message); 45 var message = options.message;
19 var okButtonLabel = /** @type {string} */ (options.buttonLabel); 46 var okButtonLabel = options.buttonLabel;
20 var cancelButtonLabel = /** @type {string} */ (options.cancelButtonLabel); 47 var cancelButtonLabel = options.cancelButtonLabel;
21 var onResult = /** @type {function(number):void} */(options.onResult); 48 var onResult = options.onResult;
22 /** @type {number} */
23 var duration = 0; 49 var duration = 0;
24 if (/** @type {number?} */(options.duration)) { 50 if (options.duration) {
25 duration = /** @type {number} */(options.duration); 51 duration = options.duration;
26 } 52 }
27 /** @type {string} */
28 var infobox = ''; 53 var infobox = '';
29 if (/** @type {string?} */(options.infobox)) { 54 if (options.infobox) {
30 infobox = /** @type {string} */(options.infobox); 55 infobox = options.infobox;
31 } 56 }
32 var onTimeout = /** @type {?function():void} */ (options.onTimeout); 57 var onTimeout = options.onTimeout;
33 58
34 /** @type {number} */ 59 /** @type {number} */
35 this.id_ = remoting.MessageWindowManager.addMessageWindow(this); 60 this.id_ = remoting.MessageWindowManager.addMessageWindow(this);
36 61
37 /** @type {?function(number):void} */ 62 /** @type {?function(number):void} */
38 this.onResult_ = onResult; 63 this.onResult_ = onResult;
39 64
40 /** @type {Window} */ 65 /** @type {Window} */
41 this.window_ = null; 66 this.window_ = null;
42 67
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 * @param {string} title The title of the message box. 201 * @param {string} title The title of the message box.
177 * @param {string} message The message. 202 * @param {string} message The message.
178 * @param {string} okButtonLabel The text for the primary button. 203 * @param {string} okButtonLabel The text for the primary button.
179 * @param {string} cancelButtonLabel The text for the secondary button. 204 * @param {string} cancelButtonLabel The text for the secondary button.
180 * @param {function(number):void} onResult The callback to invoke when the 205 * @param {function(number):void} onResult The callback to invoke when the
181 * user closes the message window. 206 * user closes the message window.
182 * @return {remoting.MessageWindow} 207 * @return {remoting.MessageWindow}
183 */ 208 */
184 remoting.MessageWindow.showConfirmWindow = function( 209 remoting.MessageWindow.showConfirmWindow = function(
185 title, message, okButtonLabel, cancelButtonLabel, onResult) { 210 title, message, okButtonLabel, cancelButtonLabel, onResult) {
186 var options = { 211 var options = /** @type {remoting.MessageWindowOptions} */ ({
187 title: title, 212 title: title,
188 message: message, 213 message: message,
189 buttonLabel: okButtonLabel, 214 buttonLabel: okButtonLabel,
190 cancelButtonLabel: cancelButtonLabel, 215 cancelButtonLabel: cancelButtonLabel,
191 onResult: onResult 216 onResult: onResult
192 }; 217 });
193 return new remoting.MessageWindow(options); 218 return new remoting.MessageWindow(options);
194 }; 219 };
195 220
196 /** 221 /**
197 * Static method to create and show a simple message box. 222 * Static method to create and show a simple message box.
198 * 223 *
199 * @param {string} title The title of the message box. 224 * @param {string} title The title of the message box.
200 * @param {string} message The message. 225 * @param {string} message The message.
201 * @param {string} buttonLabel The text for the primary button. 226 * @param {string} buttonLabel The text for the primary button.
202 * @param {function(number):void} onResult The callback to invoke when the 227 * @param {function(number):void} onResult The callback to invoke when the
203 * user closes the message window. 228 * user closes the message window.
204 * @return {remoting.MessageWindow} 229 * @return {remoting.MessageWindow}
205 */ 230 */
206 remoting.MessageWindow.showMessageWindow = function( 231 remoting.MessageWindow.showMessageWindow = function(
207 title, message, buttonLabel, onResult) { 232 title, message, buttonLabel, onResult) {
208 var options = { 233 var options = /** @type {remoting.MessageWindowOptions} */ ({
209 title: title, 234 title: title,
210 message: message, 235 message: message,
211 buttonLabel: buttonLabel, 236 buttonLabel: buttonLabel,
212 onResult: onResult 237 onResult: onResult
213 }; 238 });
214 return new remoting.MessageWindow(options); 239 return new remoting.MessageWindow(options);
215 }; 240 };
216 241
217 /** 242 /**
218 * Static method to create and show an error message box with an "OK" button. 243 * Static method to create and show an error message box with an "OK" button.
219 * The app will close when the user dismisses the message window. 244 * The app will close when the user dismisses the message window.
220 * 245 *
221 * @param {string} title The title of the message box. 246 * @param {string} title The title of the message box.
222 * @param {string} message The message. 247 * @param {string} message The message.
223 * @return {remoting.MessageWindow} 248 * @return {remoting.MessageWindow}
224 */ 249 */
225 remoting.MessageWindow.showErrorMessage = function(title, message) { 250 remoting.MessageWindow.showErrorMessage = function(title, message) {
226 var options = { 251 var options = /** @type {remoting.MessageWindowOptions} */ ({
227 title: title, 252 title: title,
228 message: message, 253 message: message,
229 buttonLabel: chrome.i18n.getMessage(/**i18n-content*/'OK'), 254 buttonLabel: chrome.i18n.getMessage(/**i18n-content*/'OK'),
230 onResult: remoting.MessageWindow.quitApp 255 onResult: remoting.MessageWindow.quitApp
231 }; 256 });
232 return new remoting.MessageWindow(options); 257 return new remoting.MessageWindow(options);
233 }; 258 };
234 259
235 /** 260 /**
236 * Static method to create and show a timed message box. 261 * Static method to create and show a timed message box.
237 * 262 *
238 * @param {string} title The title of the message box. 263 * @param {string} title The title of the message box.
239 * @param {string} message The message. 264 * @param {string} message The message.
240 * @param {string} infobox Additional information to be displayed in an infobox, 265 * @param {string} infobox Additional information to be displayed in an infobox,
241 * or the empty string if there is no additional information. 266 * or the empty string if there is no additional information.
242 * @param {string} buttonLabel The text for the primary button. 267 * @param {string} buttonLabel The text for the primary button.
243 * @param {function(number):void} onResult The callback to invoke when the 268 * @param {function(number):void} onResult The callback to invoke when the
244 * user closes the message window. 269 * user closes the message window.
245 * @param {number} duration Time for wait before calling onTime 270 * @param {number} duration Time for wait before calling onTime
246 * @param {?function():void} onTimeout Callback function. 271 * @param {?function():void} onTimeout Callback function.
247 * @return {remoting.MessageWindow} 272 * @return {remoting.MessageWindow}
248 */ 273 */
249 remoting.MessageWindow.showTimedMessageWindow = function( 274 remoting.MessageWindow.showTimedMessageWindow = function(
250 title, message, infobox, buttonLabel, onResult, duration, onTimeout) { 275 title, message, infobox, buttonLabel, onResult, duration, onTimeout) {
251 var options = { 276 var options = /** @type {remoting.MessageWindowOptions} */ ({
252 title: title, 277 title: title,
253 message: message, 278 message: message,
254 infobox: infobox, 279 infobox: infobox,
255 buttonLabel: buttonLabel, 280 buttonLabel: buttonLabel,
256 onResult: onResult, 281 onResult: onResult,
257 duration: duration, 282 duration: duration,
258 onTimeout: onTimeout 283 onTimeout: onTimeout
259 }; 284 });
260 return new remoting.MessageWindow(options); 285 return new remoting.MessageWindow(options);
261 }; 286 };
262 287
263 /** 288 /**
264 * Cancel the current connection and close all app windows. 289 * Cancel the current connection and close all app windows.
265 * 290 *
266 * @param {number} result The dialog result. 291 * @param {number} result The dialog result.
267 */ 292 */
268 remoting.MessageWindow.quitApp = function(result) { 293 remoting.MessageWindow.quitApp = function(result) {
269 remoting.MessageWindowManager.closeAllMessageWindows(); 294 remoting.MessageWindowManager.closeAllMessageWindows();
270 window.close(); 295 window.close();
271 }; 296 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698