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.
7 * Loading dialog for AppRemoting apps.
12 /** @suppress {duplicate} */
13 var remoting
= remoting
|| {};
16 * Namespace for loading window functions.
19 remoting
.LoadingWindow = function() {};
22 * When the loading window times out, replace it with a generic
23 * "Service Unavailable" message.
26 remoting
.LoadingWindow
.onTimeout_ = function() {
27 remoting
.MessageWindow
.showErrorMessage(
28 remoting
.app
.getApplicationName(),
29 chrome
.i18n
.getMessage(remoting
.Error
.SERVICE_UNAVAILABLE
));
33 * Show the loading dialog and start a timer When the timer expires, an error
34 * message will be displayed and the application will quit.
36 remoting
.LoadingWindow
.show = function() {
37 if (remoting
.loadingWindow_
) {
41 // TODO(garykac): Choose better default timeout.
42 // Timeout is currently 15min to handle when we need to spin up a new VM.
43 var kConnectionTimeout
= 15 * 60 * 1000;
45 var transparencyWarning
= '';
46 if (remoting
.platformIsMac()) {
48 chrome
.i18n
.getMessage(/*i18n-content*/'NO_TRANSPARENCY_WARNING');
50 remoting
.loadingWindow_
= remoting
.MessageWindow
.showTimedMessageWindow(
51 remoting
.app
.getApplicationName(),
52 chrome
.i18n
.getMessage(/*i18n-content*/'FOOTER_CONNECTING'),
54 chrome
.i18n
.getMessage(/*i18n-content*/'CANCEL'),
55 remoting
.MessageWindow
.quitApp
,
57 remoting
.LoadingWindow
.onTimeout_
);
61 * Close the loading window.
63 remoting
.LoadingWindow
.close = function() {
64 if (remoting
.loadingWindow_
) {
65 remoting
.loadingWindow_
.close();
67 remoting
.loadingWindow_
= null;
70 /** @type {remoting.MessageWindow} */
71 remoting
.loadingWindow_
= null;