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

Side by Side Diff: chrome/test/data/extensions/api_test/tabs/connect/echo.js

Issue 11745015: Update references to the extension messaging APIs to point to the "runtime" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Content script that echoes back all messages. 1 // Content script that echoes back all messages.
2 // Posting a message with "GET" returns the name and # of connections opened. 2 // Posting a message with "GET" returns the name and # of connections opened.
3 var connections = 0; 3 var connections = 0;
4 4
5 chrome.extension.onConnect.addListener(function onConnect(port) { 5 chrome.runtime.onConnect.addListener(function onConnect(port) {
6 connections++; 6 connections++;
7 port.onMessage.addListener(function onMessage(msg) { 7 port.onMessage.addListener(function onMessage(msg) {
8 if (msg == "GET") { 8 if (msg == "GET") {
9 port.postMessage({"name": port.name, "connections": connections}); 9 port.postMessage({"name": port.name, "connections": connections});
10 } else { 10 } else {
11 port.postMessage(msg); 11 port.postMessage(msg);
12 } 12 }
13 }); 13 });
14 }); 14 });
15 15
16 chrome.extension.onRequest.addListener(function(request, sender, respond) { 16 chrome.extension.onRequest.addListener(function(request, sender, respond) {
17 respond(request); 17 respond(request);
18 }); 18 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698