Service CreateNewWindow on the UI thread with a new mojo interface

This patch replaces the IO-thread handler for CreateNewWindow with a
UI-thread version, using a new mojo interface called FrameHost. The
existing FrameHost interface is renamed to FrameHostInterfaceBroker.

This is an associated interface, so messages will remain ordered with
respect to the traditional IPC pipe.

There are a few changes that happened as a result of this approach:
1. ContentBrowserClient::CanCreateWindow is now on the UI thread. This
means policy makers need some UI thread context. Since the UI thread is
usually better at making policy decisions in general, most components
were simplified here.

This was the main impetus of this change, because we wanted an easy
place to put window opening policy decisions.

2. Since the mojo interface is now frame-based, all window opening logic
moved to RenderFrameHostImpl.

3. window.open() is a sync IPC. This change makes the sync wait longer
because we create the UI thread objects before replying.

CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_site_isolation
BUG=35980

[email protected],[email protected]

Review-Url: https://codereview.chromium.org/2821473002
Cr-Commit-Position: refs/heads/master@{#466700}
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 4ee6d4f7f..5438b78d 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -480,7 +480,7 @@
 
   void RegisterPendingFrameCreate(int routing_id,
                                   mojom::FrameRequest frame,
-                                  mojom::FrameHostPtr host);
+                                  mojom::FrameHostInterfaceBrokerPtr host);
 
   mojom::StoragePartitionService* GetStoragePartitionService();
 
@@ -743,14 +743,16 @@
 
   class PendingFrameCreate : public base::RefCounted<PendingFrameCreate> {
    public:
-     PendingFrameCreate(int routing_id,
-                        mojom::FrameRequest frame_request,
-                        mojom::FrameHostPtr frame_host);
+    PendingFrameCreate(
+        int routing_id,
+        mojom::FrameRequest frame_request,
+        mojom::FrameHostInterfaceBrokerPtr frame_host_interface_broker);
 
     mojom::FrameRequest TakeFrameRequest() { return std::move(frame_request_); }
-    mojom::FrameHostPtr TakeFrameHost() {
-      frame_host_.set_connection_error_handler(base::Closure());
-      return std::move(frame_host_);
+    mojom::FrameHostInterfaceBrokerPtr TakeInterfaceBroker() {
+      frame_host_interface_broker_.set_connection_error_handler(
+          base::Closure());
+      return std::move(frame_host_interface_broker_);
     }
 
    private:
@@ -763,7 +765,7 @@
 
     int routing_id_;
     mojom::FrameRequest frame_request_;
-    mojom::FrameHostPtr frame_host_;
+    mojom::FrameHostInterfaceBrokerPtr frame_host_interface_broker_;
   };
 
   using PendingFrameCreateMap =