diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 9f447f8e34e4..736fb7ca0fb1 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1088,14 +1088,10 @@ void WebContents::TabTraverse(bool reverse) { web_contents()->FocusThroughTabTraversal(reverse); } -bool WebContents::SendIPCMessage(const base::string16& channel, +bool WebContents::SendIPCMessage(bool all_frames, + const base::string16& channel, const base::ListValue& args) { - return Send(new AtomViewMsg_Message(routing_id(), false, channel, args)); -} - -bool WebContents::SendIPCMessageToAll(const base::string16& channel, - const base::ListValue& args) { - return Send(new AtomViewMsg_Message(routing_id(), true, channel, args)); + return Send(new AtomViewMsg_Message(routing_id(), all_frames, channel, args)); } void WebContents::SendInputEvent(v8::Isolate* isolate, @@ -1263,7 +1259,6 @@ void WebContents::BuildPrototype(v8::Isolate* isolate, .SetMethod("focus", &WebContents::Focus) .SetMethod("tabTraverse", &WebContents::TabTraverse) .SetMethod("_send", &WebContents::SendIPCMessage) - .SetMethod("_sendToAll", &WebContents::SendIPCMessageToAll) .SetMethod("sendInputEvent", &WebContents::SendInputEvent) .SetMethod("beginFrameSubscription", &WebContents::BeginFrameSubscription) diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 7f90c33ea8f0..e03ab653a8ce 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -122,10 +122,9 @@ class WebContents : public mate::TrackableObject, void TabTraverse(bool reverse); // Send messages to browser. - bool SendIPCMessage(const base::string16& channel, + bool SendIPCMessage(bool all_frames, + const base::string16& channel, const base::ListValue& args); - bool SendIPCMessageToAll(const base::string16& channel, - const base::ListValue& args); // Send WebInputEvent to the page. void SendInputEvent(v8::Isolate* isolate, v8::Local input_event); diff --git a/lib/browser/api/web-contents.js b/lib/browser/api/web-contents.js index 1b601f095dbb..0f79a185ffc9 100644 --- a/lib/browser/api/web-contents.js +++ b/lib/browser/api/web-contents.js @@ -71,20 +71,15 @@ let wrapWebContents = function (webContents) { webContents.setMaxListeners(0) // WebContents::send(channel, args..) - webContents.send = function (channel, ...args) { - if (channel == null) { - throw new Error('Missing required channel argument') - } - return this._send(channel, args) - } - // WebContents::sendToAll(channel, args..) - webContents.sendToAll = function (channel, ...args) { + const sendWrapper = (allFrames, channel, ...args) => { if (channel == null) { throw new Error('Missing required channel argument') } - return this._sendToAll(channel, args) + return webContents._send(allFrames, channel, args) } + webContents.send = sendWrapper.bind(null, false) + webContents.sendToAll = sendWrapper.bind(null, true) // The navigation controller. controller = new NavigationController(webContents)