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

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: rebase 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 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
1 // Content script that echoes back all messages. 5 // Content script that echoes back all messages.
2 // Posting a message with "GET" returns the name and # of connections opened. 6 // Posting a message with "GET" returns the name and # of connections opened.
3 var connections = 0; 7 var connections = 0;
4 8
5 chrome.extension.onConnect.addListener(function onConnect(port) { 9 chrome.runtime.onConnect.addListener(function onConnect(port) {
6 connections++; 10 connections++;
7 port.onMessage.addListener(function onMessage(msg) { 11 port.onMessage.addListener(function onMessage(msg) {
8 if (msg == "GET") { 12 if (msg == "GET") {
9 port.postMessage({"name": port.name, "connections": connections}); 13 port.postMessage({"name": port.name, "connections": connections});
10 } else { 14 } else {
11 port.postMessage(msg); 15 port.postMessage(msg);
12 } 16 }
13 }); 17 });
14 }); 18 });
15 19
16 chrome.extension.onRequest.addListener(function(request, sender, respond) { 20 chrome.extension.onRequest.addListener(function(request, sender, respond) {
17 respond(request); 21 respond(request);
18 }); 22 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698