| 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * Loading dialog for AppRemoting apps. | 7 * Loading dialog for AppRemoting apps. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 */ | 35 */ |
| 36 remoting.LoadingWindow.show = function() { | 36 remoting.LoadingWindow.show = function() { |
| 37 if (remoting.loadingWindow_) { | 37 if (remoting.loadingWindow_) { |
| 38 return; | 38 return; |
| 39 } | 39 } |
| 40 | 40 |
| 41 // TODO(garykac): Choose better default timeout. | 41 // TODO(garykac): Choose better default timeout. |
| 42 // Timeout is currently 15min to handle when we need to spin up a new VM. | 42 // Timeout is currently 15min to handle when we need to spin up a new VM. |
| 43 var kConnectionTimeout = 15 * 60 * 1000; | 43 var kConnectionTimeout = 15 * 60 * 1000; |
| 44 | 44 |
| 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 }); |
| 45 var transparencyWarning = ''; | 55 var transparencyWarning = ''; |
| 46 if (remoting.platformIsMac()) { | 56 if (remoting.platformIsMac()) { |
| 47 transparencyWarning = | 57 options.infoBox = |
| 48 chrome.i18n.getMessage(/*i18n-content*/'NO_TRANSPARENCY_WARNING'); | 58 chrome.i18n.getMessage(/*i18n-content*/'NO_TRANSPARENCY_WARNING'); |
| 49 } | 59 } |
| 50 remoting.loadingWindow_ = remoting.MessageWindow.showTimedMessageWindow( | 60 remoting.loadingWindow_ = new remoting.MessageWindow(options); |
| 51 remoting.app.getApplicationName(), | |
| 52 chrome.i18n.getMessage(/*i18n-content*/'FOOTER_CONNECTING'), | |
| 53 transparencyWarning, | |
| 54 chrome.i18n.getMessage(/*i18n-content*/'CANCEL'), | |
| 55 remoting.MessageWindow.quitApp, | |
| 56 kConnectionTimeout, | |
| 57 remoting.LoadingWindow.onTimeout_); | |
| 58 }; | 61 }; |
| 59 | 62 |
| 60 /** | 63 /** |
| 61 * Close the loading window. | 64 * Close the loading window. |
| 62 */ | 65 */ |
| 63 remoting.LoadingWindow.close = function() { | 66 remoting.LoadingWindow.close = function() { |
| 64 if (remoting.loadingWindow_) { | 67 if (remoting.loadingWindow_) { |
| 65 remoting.loadingWindow_.close(); | 68 remoting.loadingWindow_.close(); |
| 66 } | 69 } |
| 67 remoting.loadingWindow_ = null; | 70 remoting.loadingWindow_ = null; |
| 68 }; | 71 }; |
| 69 | 72 |
| 70 /** @type {remoting.MessageWindow} */ | 73 /** @type {remoting.MessageWindow} */ |
| 71 remoting.loadingWindow_ = null; | 74 remoting.loadingWindow_ = null; |
| OLD | NEW |