Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: chrome/test/data/webui/inject_comm_channel.js

Issue 1056533002: Implement <webview>.addContentScript/removeContentScript API [2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webview_addremove_contentscripts_2
Patch Set: nits. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
OLDNEW
« no previous file with comments | « chrome/test/data/guest_from_opener.html ('k') | chrome/test/data/webui/inject_comm_channel_2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698