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

Unified Diff: chrome/test/data/extensions/api_test/messaging/externally_connectable/web_connectable/background.js

Issue 16174005: Implement externally_connectable! Web pages can now communicate directly with (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: absolute path... Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/messaging/externally_connectable/web_connectable/background.js
diff --git a/chrome/test/data/extensions/api_test/messaging/externally_connectable/web_connectable/background.js b/chrome/test/data/extensions/api_test/messaging/externally_connectable/web_connectable/background.js
new file mode 100644
index 0000000000000000000000000000000000000000..6a0e893af05f6063aaadda4b6ddf7052f2300ea7
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/messaging/externally_connectable/web_connectable/background.js
@@ -0,0 +1,16 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// The test extension for externally_connectable just echos all messages it
+// gets. The test runners are in the sites/ directory.
+
+chrome.runtime.onMessageExternal.addListener(function(message, sender, reply) {
+ reply({ message: message, sender: sender });
+});
+
+chrome.runtime.onConnectExternal.addListener(function(port) {
+ port.onMessage.addListener(function(message) {
+ port.postMessage({ message: message, sender: port.sender });
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698