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

Side by Side Diff: chrome/test/data/webui/inject_comm_channel_2.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 2015 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_request() { 7 function reportConnected_request() {
8 window.console.log('Reporting connection to embedder.');
9 var msg = ['connected_response']; 8 var msg = ['connected_response'];
10 embedder.postMessage(JSON.stringify(msg), '*'); 9 embedder.postMessage(JSON.stringify(msg), '*');
11 } 10 }
12 11
13 window.addEventListener('message', function(e) { 12 window.addEventListener('message', function(e) {
14 embedder = e.source; 13 embedder = e.source;
15 var data = JSON.parse(e.data); 14 var data = JSON.parse(e.data);
16 switch (data[0]) { 15 switch (data[0]) {
17 case 'connect_request': { 16 case 'connect_request': {
18 reportConnected_request(); 17 reportConnected_request();
19 break; 18 break;
20 } 19 }
21 } 20 }
22 }); 21 });
23
24
25 window.console.log('Script has been successfully injected.');
OLDNEW
« no previous file with comments | « chrome/test/data/webui/inject_comm_channel.js ('k') | chrome/test/data/webui/webview_execute_script_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698