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

Side by Side Diff: extensions/renderer/resources/messaging.js

Issue 2973903002: [Extensions Bindings] Introduce a supportsLazyListeners property (Closed)
Patch Set: onMessage event fix Created 3 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // chrome.runtime.messaging API implementation. 5 // chrome.runtime.messaging API implementation.
6 // TODO(robwu): Fix this indentation. 6 // TODO(robwu): Fix this indentation.
7 7
8 // TODO(kalman): factor requiring chrome out of here. 8 // TODO(kalman): factor requiring chrome out of here.
9 var chrome = requireNative('chrome').GetChrome(); 9 var chrome = requireNative('chrome').GetChrome();
10 var logActivity = requireNative('activityLogger'); 10 var logActivity = requireNative('activityLogger');
11 var logging = requireNative('logging'); 11 var logging = requireNative('logging');
12 var messagingNatives = requireNative('messaging_natives'); 12 var messagingNatives = requireNative('messaging_natives');
13 var processNatives = requireNative('process'); 13 var processNatives = requireNative('process');
14 var utils = require('utils'); 14 var utils = require('utils');
15 var messagingUtils = require('messaging_utils'); 15 var messagingUtils = require('messaging_utils');
16 16
17 // The reserved channel name for the sendRequest/send(Native)Message APIs. 17 // The reserved channel name for the sendRequest/send(Native)Message APIs.
18 // Note: sendRequest is deprecated. 18 // Note: sendRequest is deprecated.
19 var kRequestChannel = "chrome.extension.sendRequest"; 19 var kRequestChannel = "chrome.extension.sendRequest";
20 var kMessageChannel = "chrome.runtime.sendMessage"; 20 var kMessageChannel = "chrome.runtime.sendMessage";
21 var kNativeMessageChannel = "chrome.runtime.sendNativeMessage"; 21 var kNativeMessageChannel = "chrome.runtime.sendNativeMessage";
22 var kPortClosedError = 'Attempting to use a disconnected port object'; 22 var kPortClosedError = 'Attempting to use a disconnected port object';
23 23
24 var jsEvent; 24 var jsEvent;
25 function createAnonymousEvent(schema) { 25 function createAnonymousEvent(schema) {
26 if (bindingUtil) { 26 if (bindingUtil) {
27 var supportsFilters = false;
28 var supportsLazyListeners = false;
27 // Native custom events ignore schema. 29 // Native custom events ignore schema.
28 var supportsFilters = false;
29 return bindingUtil.createCustomEvent(undefined, undefined, 30 return bindingUtil.createCustomEvent(undefined, undefined,
30 supportsFilters); 31 supportsFilters,
32 supportsLazyListeners);
31 } 33 }
32 var options = { 34 var options = {
33 __proto__: null, 35 __proto__: null,
34 unmanaged: true, 36 unmanaged: true,
35 }; 37 };
36 if (!jsEvent) 38 if (!jsEvent)
37 jsEvent = require('event_bindings').Event; 39 jsEvent = require('event_bindings').Event;
38 return new jsEvent(undefined, schema, options); 40 return new jsEvent(undefined, schema, options);
39 } 41 }
40 42
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 exports.$set('kNativeMessageChannel', kNativeMessageChannel); 486 exports.$set('kNativeMessageChannel', kNativeMessageChannel);
485 exports.$set('Port', Port); 487 exports.$set('Port', Port);
486 exports.$set('createPort', createPort); 488 exports.$set('createPort', createPort);
487 exports.$set('sendMessageImpl', sendMessageImpl); 489 exports.$set('sendMessageImpl', sendMessageImpl);
488 exports.$set('sendMessageUpdateArguments', sendMessageUpdateArguments); 490 exports.$set('sendMessageUpdateArguments', sendMessageUpdateArguments);
489 491
490 // For C++ code to call. 492 // For C++ code to call.
491 exports.$set('dispatchOnConnect', dispatchOnConnect); 493 exports.$set('dispatchOnConnect', dispatchOnConnect);
492 exports.$set('dispatchOnDisconnect', dispatchOnDisconnect); 494 exports.$set('dispatchOnDisconnect', dispatchOnDisconnect);
493 exports.$set('dispatchOnMessage', dispatchOnMessage); 495 exports.$set('dispatchOnMessage', dispatchOnMessage);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698