refactor: use separate ipc-renderer-internal / ipc-main-internal APIs for Electron internals (#13940)
This commit is contained in:
		
					parent
					
						
							
								f7122610cc
							
						
					
				
			
			
				commit
				
					
						b50f86ef43
					
				
			
		
					 49 changed files with 322 additions and 133 deletions
				
			
		| 
						 | 
				
			
			@ -1578,20 +1578,23 @@ void WebContents::TabTraverse(bool reverse) {
 | 
			
		|||
  web_contents()->FocusThroughTabTraversal(reverse);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool WebContents::SendIPCMessage(bool all_frames,
 | 
			
		||||
bool WebContents::SendIPCMessage(bool internal,
 | 
			
		||||
                                 bool send_to_all,
 | 
			
		||||
                                 const std::string& channel,
 | 
			
		||||
                                 const base::ListValue& args) {
 | 
			
		||||
  return SendIPCMessageWithSender(all_frames, channel, args);
 | 
			
		||||
  return SendIPCMessageWithSender(internal, send_to_all, channel, args);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool WebContents::SendIPCMessageWithSender(bool all_frames,
 | 
			
		||||
bool WebContents::SendIPCMessageWithSender(bool internal,
 | 
			
		||||
                                           bool send_to_all,
 | 
			
		||||
                                           const std::string& channel,
 | 
			
		||||
                                           const base::ListValue& args,
 | 
			
		||||
                                           int32_t sender_id) {
 | 
			
		||||
  auto* frame_host = web_contents()->GetMainFrame();
 | 
			
		||||
  if (frame_host) {
 | 
			
		||||
    return frame_host->Send(new AtomFrameMsg_Message(
 | 
			
		||||
        frame_host->GetRoutingID(), all_frames, channel, args, sender_id));
 | 
			
		||||
    return frame_host->Send(new AtomFrameMsg_Message(frame_host->GetRoutingID(),
 | 
			
		||||
                                                     internal, send_to_all,
 | 
			
		||||
                                                     channel, args, sender_id));
 | 
			
		||||
  }
 | 
			
		||||
  return false;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -2107,6 +2110,7 @@ void WebContents::OnRendererMessageSync(content::RenderFrameHost* frame_host,
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void WebContents::OnRendererMessageTo(content::RenderFrameHost* frame_host,
 | 
			
		||||
                                      bool internal,
 | 
			
		||||
                                      bool send_to_all,
 | 
			
		||||
                                      int32_t web_contents_id,
 | 
			
		||||
                                      const std::string& channel,
 | 
			
		||||
| 
						 | 
				
			
			@ -2115,7 +2119,8 @@ void WebContents::OnRendererMessageTo(content::RenderFrameHost* frame_host,
 | 
			
		|||
      isolate(), web_contents_id);
 | 
			
		||||
 | 
			
		||||
  if (web_contents) {
 | 
			
		||||
    web_contents->SendIPCMessageWithSender(send_to_all, channel, args, ID());
 | 
			
		||||
    web_contents->SendIPCMessageWithSender(internal, send_to_all, channel, args,
 | 
			
		||||
                                           ID());
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -179,11 +179,13 @@ class WebContents : public mate::TrackableObject<WebContents>,
 | 
			
		|||
  void TabTraverse(bool reverse);
 | 
			
		||||
 | 
			
		||||
  // Send messages to browser.
 | 
			
		||||
  bool SendIPCMessage(bool all_frames,
 | 
			
		||||
  bool SendIPCMessage(bool internal,
 | 
			
		||||
                      bool send_to_all,
 | 
			
		||||
                      const std::string& channel,
 | 
			
		||||
                      const base::ListValue& args);
 | 
			
		||||
 | 
			
		||||
  bool SendIPCMessageWithSender(bool all_frames,
 | 
			
		||||
  bool SendIPCMessageWithSender(bool internal,
 | 
			
		||||
                                bool send_to_all,
 | 
			
		||||
                                const std::string& channel,
 | 
			
		||||
                                const base::ListValue& args,
 | 
			
		||||
                                int32_t sender_id = 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -442,6 +444,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
 | 
			
		|||
 | 
			
		||||
  // Called when received a message from renderer to be forwarded.
 | 
			
		||||
  void OnRendererMessageTo(content::RenderFrameHost* frame_host,
 | 
			
		||||
                           bool internal,
 | 
			
		||||
                           bool send_to_all,
 | 
			
		||||
                           int32_t web_contents_id,
 | 
			
		||||
                           const std::string& channel,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue