Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / remoting / webapp / app_remoting / js / loading_window.js
blobfcb2eb681c802652a7c1f21715889feb85a639ad
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.
5 /**
6 * @fileoverview
7 * Loading dialog for AppRemoting apps.
8 */
10 'use strict';
12 /** @suppress {duplicate} */
13 var remoting = remoting || {};
15 /**
16 * Namespace for loading window functions.
17 * @type {Object}
19 remoting.LoadingWindow = function() {};
21 /**
22 * When the loading window times out, replace it with a generic
23 * "Service Unavailable" message.
24 * @private
26 remoting.LoadingWindow.onTimeout_ = function() {
27 remoting.MessageWindow.showErrorMessage(
28 remoting.app.getApplicationName(),
29 chrome.i18n.getMessage(remoting.Error.Tag.SERVICE_UNAVAILABLE));
32 /**
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_) {
38 return;
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 options = /** @type {remoting.MessageWindowOptions} */ ({
46 title: remoting.app.getApplicationName(),
47 message: chrome.i18n.getMessage(/*i18n-content*/'FOOTER_CONNECTING'),
48 buttonLabel: chrome.i18n.getMessage(/*i18n-content*/'CANCEL'),
49 onResult: remoting.MessageWindow.quitApp,
50 duration: kConnectionTimeout,
51 onTimeout: remoting.LoadingWindow.onTimeout_,
52 htmlFile: 'loading_window.html',
53 frame: 'none',
54 minimumWidth: 200
55 });
56 var transparencyWarning = '';
57 if (remoting.platformIsMac()) {
58 options.infoBox =
59 chrome.i18n.getMessage(/*i18n-content*/'NO_TRANSPARENCY_WARNING');
61 remoting.loadingWindow_ = new remoting.MessageWindow(options);
64 /**
65 * Close the loading window.
67 remoting.LoadingWindow.close = function() {
68 if (remoting.loadingWindow_) {
69 remoting.loadingWindow_.close();
71 remoting.loadingWindow_ = null;
74 /** @type {remoting.MessageWindow} */
75 remoting.loadingWindow_ = null;