WebContents and WebContentsObserver should not provide IPC::Sender API.

With the introduction of OOPIFs, WebContents can span multiple processes
- there is no default process to send IPC messages to.  Removing the
WebContents::Send and WebContentsObserver::Send methods forces the
callers to explicitly specify the target of the message.  This helps
avoid situations where an IPC message is sent via RenderViewHost (i.e.
to the process hosting the main frame) when it should have been send to
a process hosting a specific frame (this CL fixes a few such cases).

Bug: 663029
Change-Id: I16980f5ef05a8ac7da365edf7a92ce46677a8c0c
Reviewed-on: https://chromium-review.googlesource.com/630416
Reviewed-by: Gene Gutnik <[email protected]>
Reviewed-by: Selim Gurun <[email protected]>
Reviewed-by: Lei Zhang <[email protected]>
Reviewed-by: Bernhard Bauer <[email protected]>
Reviewed-by: Lucas Gadani <[email protected]>
Reviewed-by: Alex Clarke <[email protected]>
Reviewed-by: Nick Carter <[email protected]>
Commit-Queue: Ɓukasz Anforowicz <[email protected]>
Cr-Commit-Position: refs/heads/master@{#500170}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 657746b..67c08c84 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2959,15 +2959,6 @@
   return new_contents;
 }
 
-bool WebContentsImpl::Send(IPC::Message* message) {
-  if (!GetRenderViewHost()) {
-    delete message;
-    return false;
-  }
-
-  return GetRenderViewHost()->Send(message);
-}
-
 void WebContentsImpl::RenderFrameForInterstitialPageCreated(
     RenderFrameHost* render_frame_host) {
   for (auto& observer : observers_)
@@ -3524,8 +3515,8 @@
 }
 
 void WebContentsImpl::SetPageScale(float page_scale_factor) {
-  Send(new ViewMsg_SetPageScale(GetRenderViewHost()->GetRoutingID(),
-                                page_scale_factor));
+  GetRenderViewHost()->Send(new ViewMsg_SetPageScale(
+      GetRenderViewHost()->GetRoutingID(), page_scale_factor));
 }
 
 gfx::Size WebContentsImpl::GetPreferredSize() const {