Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 // This is the content page script. This runs in the context of the browser | |
|
Emily Fortuna
2012/10/09 20:27:24
nit: but in some files you use the /** */ style no
| |
| 6 // page, and communicates with the background page by relaying a getMessages | |
| 7 // request, and the forwarding the messages back to the browser page as a | |
| 8 // gotMessages message. | |
| 9 window.addEventListener("message", function(event) { | |
| 10 if (event.source == window && event.data == "getMessages") { | |
| 11 // Log a special sentinel message to mark the end of the messages. | |
| 12 console.log('getMessages/end'); | |
| 13 chrome.extension.sendRequest({command: "getMessages"}, function(messages) { | |
| 14 window.postMessage({ "type": "gotMessages", "messages" : messages}, "*"); | |
| 15 }); | |
| 16 } | |
| 17 }, false); | |
| OLD | NEW |