| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 var embedder = null; | 5 var embedder = null; |
| 6 | 6 |
| 7 function reportConnected() { | 7 function reportConnected() { |
| 8 var msg = ['connected']; | 8 var msg = ['connected']; |
| 9 embedder.postMessage(JSON.stringify(msg), '*'); | 9 embedder.postMessage(JSON.stringify(msg), '*'); |
| 10 } | 10 } |
| 11 | 11 |
| 12 window.addEventListener('message', function(e) { | 12 window.addEventListener('message', function(e) { |
| 13 embedder = e.source; | 13 embedder = e.source; |
| 14 var data = JSON.parse(e.data); | 14 var data = JSON.parse(e.data); |
| 15 switch (data[0]) { | 15 switch (data[0]) { |
| 16 case 'connect': { | 16 case 'connect': { |
| 17 reportConnected(); | 17 reportConnected(); |
| 18 break; | 18 break; |
| 19 } | 19 } |
| 20 } | 20 } |
| 21 }); | 21 }); |
| 22 | |
| OLD | NEW |