| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 /** @param {chrome.app.window.AppWindow} appWindow */ | 114 /** @param {chrome.app.window.AppWindow} appWindow */ |
| 115 var onCreate = function(appWindow) { | 115 var onCreate = function(appWindow) { |
| 116 that.setWindow_(/** @type {Window} */(appWindow.contentWindow)); | 116 that.setWindow_(/** @type {Window} */(appWindow.contentWindow)); |
| 117 var onLoad = function() { | 117 var onLoad = function() { |
| 118 appWindow.contentWindow.postMessage(message_struct, '*'); | 118 appWindow.contentWindow.postMessage(message_struct, '*'); |
| 119 }; | 119 }; |
| 120 appWindow.contentWindow.addEventListener('load', onLoad, false); | 120 appWindow.contentWindow.addEventListener('load', onLoad, false); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 var htmlFile = options.htmlFile || 'message_window.html'; | 123 var htmlFile = options.htmlFile || 'message_window.html'; |
| 124 chrome.app.window.create( | 124 chrome.app.window.create(htmlFile, windowAttributes, onCreate); |
| 125 remoting.MessageWindow.htmlFilePrefix + htmlFile, | |
| 126 windowAttributes, onCreate); | |
| 127 | 125 |
| 128 if (duration != 0) { | 126 if (duration != 0) { |
| 129 this.timer_ = window.setTimeout(this.onTimeoutHandler_.bind(this), | 127 this.timer_ = window.setTimeout(this.onTimeoutHandler_.bind(this), |
| 130 duration); | 128 duration); |
| 131 } | 129 } |
| 132 }; | 130 }; |
| 133 | 131 |
| 134 /** | 132 /** |
| 135 * This string is prepended to the htmlFile when message windows are created. | |
| 136 * Normally, this should be left empty, but the shared module needs to specify | |
| 137 * this so that the shared HTML files can be found when running in the | |
| 138 * context of the app stub. | |
| 139 * @type {string} | |
| 140 */ | |
| 141 remoting.MessageWindow.htmlFilePrefix = ""; | |
| 142 | |
| 143 /** | |
| 144 * Called when the timer runs out. This in turn calls the window's | 133 * Called when the timer runs out. This in turn calls the window's |
| 145 * timeout handler (if any). | 134 * timeout handler (if any). |
| 146 */ | 135 */ |
| 147 remoting.MessageWindow.prototype.onTimeoutHandler_ = function() { | 136 remoting.MessageWindow.prototype.onTimeoutHandler_ = function() { |
| 148 this.close(); | 137 this.close(); |
| 149 if (this.onTimeout_) { | 138 if (this.onTimeout_) { |
| 150 this.onTimeout_(); | 139 this.onTimeout_(); |
| 151 } | 140 } |
| 152 }; | 141 }; |
| 153 | 142 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 272 |
| 284 /** | 273 /** |
| 285 * Cancel the current connection and close all app windows. | 274 * Cancel the current connection and close all app windows. |
| 286 * | 275 * |
| 287 * @param {number} result The dialog result. | 276 * @param {number} result The dialog result. |
| 288 */ | 277 */ |
| 289 remoting.MessageWindow.quitApp = function(result) { | 278 remoting.MessageWindow.quitApp = function(result) { |
| 290 remoting.MessageWindowManager.closeAllMessageWindows(); | 279 remoting.MessageWindowManager.closeAllMessageWindows(); |
| 291 window.close(); | 280 window.close(); |
| 292 }; | 281 }; |
| OLD | NEW |