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 /** | 7 /** |
8 * @constructor | 8 * @constructor |
9 */ | 9 */ |
10 function MessageWindowImpl() { | 10 function MessageWindowImpl() { |
11 /** | 11 /** |
12 * Used to prevent multiple responses due to the closeWindow handler. | 12 * Used to prevent multiple responses due to the closeWindow handler. |
13 * | 13 * |
14 * @type {boolean} | 14 * @private {boolean} |
15 * @private | |
16 */ | 15 */ |
17 this.sentReply_ = false; | 16 this.sentReply_ = false; |
18 | 17 |
19 window.addEventListener('message', this.onMessage_.bind(this), false); | 18 window.addEventListener('message', this.onMessage_.bind(this), false); |
20 }; | 19 }; |
21 | 20 |
22 /** | 21 /** |
23 * @param {Window} parentWindow The id of the window that showed the message. | 22 * @param {Window} parentWindow The id of the window that showed the message. |
24 * @param {number} messageId The identifier of the message, as supplied by the | 23 * @param {number} messageId The identifier of the message, as supplied by the |
25 * parent. | 24 * parent. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 146 |
148 base.resizeWindowToContent(); | 147 base.resizeWindowToContent(); |
149 break; | 148 break; |
150 | 149 |
151 default: | 150 default: |
152 console.error('Unexpected message:', event.data); | 151 console.error('Unexpected message:', event.data); |
153 } | 152 } |
154 }; | 153 }; |
155 | 154 |
156 var messageWindow = new MessageWindowImpl(); | 155 var messageWindow = new MessageWindowImpl(); |
OLD | NEW |