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

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

Issue 2973903002: [Extensions Bindings] Introduce a supportsLazyListeners property (Closed)
Patch Set: . 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 lastError = require('lastError'); 10 var lastError = require('lastError');
11 var logActivity = requireNative('activityLogger'); 11 var logActivity = requireNative('activityLogger');
12 var logging = requireNative('logging'); 12 var logging = requireNative('logging');
13 var messagingNatives = requireNative('messaging_natives'); 13 var messagingNatives = requireNative('messaging_natives');
14 var processNatives = requireNative('process'); 14 var processNatives = requireNative('process');
15 var utils = require('utils'); 15 var utils = require('utils');
16 var messagingUtils = require('messaging_utils'); 16 var messagingUtils = require('messaging_utils');
17 17
18 // The reserved channel name for the sendRequest/send(Native)Message APIs. 18 // The reserved channel name for the sendRequest/send(Native)Message APIs.
19 // Note: sendRequest is deprecated. 19 // Note: sendRequest is deprecated.
20 var kRequestChannel = "chrome.extension.sendRequest"; 20 var kRequestChannel = "chrome.extension.sendRequest";
21 var kMessageChannel = "chrome.runtime.sendMessage"; 21 var kMessageChannel = "chrome.runtime.sendMessage";
22 var kNativeMessageChannel = "chrome.runtime.sendNativeMessage"; 22 var kNativeMessageChannel = "chrome.runtime.sendNativeMessage";
23 var kPortClosedError = 'Attempting to use a disconnected port object'; 23 var kPortClosedError = 'Attempting to use a disconnected port object';
24 24
25 var jsEvent; 25 var jsEvent;
26 function createAnonymousEvent(schema) { 26 function createAnonymousEvent(schema) {
27 if (bindingUtil) { 27 if (bindingUtil) {
28 var supportsFilters = false;
29 var supportsLazyListeners = false;
lazyboy 2017/07/14 00:04:42 Do we need true here?
Devlin 2017/07/14 15:37:54 Nope, see previous comment.
lazyboy 2017/07/17 23:38:50 Acknowledged.
28 // Native custom events ignore schema. 30 // Native custom events ignore schema.
29 var supportsFilters = false;
30 return bindingUtil.createCustomEvent(undefined, undefined, 31 return bindingUtil.createCustomEvent(undefined, undefined,
31 supportsFilters); 32 supportsFilters,
33 supportsLazyListeners);
32 } 34 }
33 var options = { 35 var options = {
34 __proto__: null, 36 __proto__: null,
35 unmanaged: true, 37 unmanaged: true,
36 }; 38 };
37 if (!jsEvent) 39 if (!jsEvent)
38 jsEvent = require('event_bindings').Event; 40 jsEvent = require('event_bindings').Event;
39 return new jsEvent(undefined, schema, options); 41 return new jsEvent(undefined, schema, options);
40 } 42 }
41 43
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 exports.$set('kNativeMessageChannel', kNativeMessageChannel); 466 exports.$set('kNativeMessageChannel', kNativeMessageChannel);
465 exports.$set('Port', Port); 467 exports.$set('Port', Port);
466 exports.$set('createPort', createPort); 468 exports.$set('createPort', createPort);
467 exports.$set('sendMessageImpl', sendMessageImpl); 469 exports.$set('sendMessageImpl', sendMessageImpl);
468 exports.$set('sendMessageUpdateArguments', sendMessageUpdateArguments); 470 exports.$set('sendMessageUpdateArguments', sendMessageUpdateArguments);
469 471
470 // For C++ code to call. 472 // For C++ code to call.
471 exports.$set('dispatchOnConnect', dispatchOnConnect); 473 exports.$set('dispatchOnConnect', dispatchOnConnect);
472 exports.$set('dispatchOnDisconnect', dispatchOnDisconnect); 474 exports.$set('dispatchOnDisconnect', dispatchOnDisconnect);
473 exports.$set('dispatchOnMessage', dispatchOnMessage); 475 exports.$set('dispatchOnMessage', dispatchOnMessage);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698