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

Unified Diff: chrome/test/data/native_messaging/native_hosts/echo.py

Issue 12406002: Pass ID of the calling extension to the native messaging host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/native_messaging/native_hosts/echo.py
diff --git a/chrome/test/data/native_messaging/native_hosts/echo.py b/chrome/test/data/native_messaging/native_hosts/echo.py
index d0be74bdfe9cb84b8767afe5f63676a2412c89f4..96c19f71cb25479175908c9f35f91e4161e4c4d4 100755
--- a/chrome/test/data/native_messaging/native_hosts/echo.py
+++ b/chrome/test/data/native_messaging/native_hosts/echo.py
@@ -12,6 +12,11 @@ import struct
def Main():
message_number = 0
+ if len(sys.argv) < 2:
+ sys.stderr.write("URL of the calling application is not specified.\n")
+ return;
+ caller_url = sys.argv[1]
+
while 1:
# Read the message type (first 4 bytes).
text_length_bytes = sys.stdin.read(4)
@@ -27,8 +32,8 @@ def Main():
message_number += 1
- response = '{{"id": {0}, "echo": {1}}}'.format(message_number,
- text).encode('utf-8')
+ response = '{{"id": {0}, "echo": {1}, "caller_url": "{2}"}}'.format(
+ message_number, text, caller_url).encode('utf-8')
try:
sys.stdout.write(struct.pack("I", len(response)))
« no previous file with comments | « chrome/test/data/native_messaging/native_hosts/echo.bat ('k') | chrome/test/data/native_messaging/native_hosts/empty_app.bat » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698