Support exposing Mojo services between render frames, render threads, and their respective hosts.

This introduces ServiceRegistry as an abstraction around providing
services to and accessing services from a remote peer. In particular,
this adds peered service registries to RenderProcessHost and
RenderThread, and to RenderFrameHost and RenderFrame - the RenderFrame
setup is implemented using the RenderProcessHost/RenderThread
ServiceRegistry pair.

This replaces the existing WebUI handle setup by adding a webUI
controller service to the frame host registry and a corresponding
request for the webUI controller service to the frame registry.

BUG=386155

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=279557

Review URL: https://codereview.chromium.org/285333003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279623 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index 71be416..117cc0b 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -14,6 +14,7 @@
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
 #include "base/process/process_handle.h"
+#include "content/common/mojo/service_registry_impl.h"
 #include "content/public/common/javascript_message_type.h"
 #include "content/public/common/referrer.h"
 #include "content/public/renderer/render_frame.h"
@@ -222,6 +223,7 @@
                                  blink::WebNavigationPolicy policy) OVERRIDE;
   virtual void ExecuteJavaScript(const base::string16& javascript) OVERRIDE;
   virtual bool IsHidden() OVERRIDE;
+  virtual ServiceRegistry* GetServiceRegistry() OVERRIDE;
 
   // blink::WebFrameClient implementation:
   virtual blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
@@ -397,6 +399,11 @@
   // this back to private member.
   void OnNavigate(const FrameMsg_Navigate_Params& params);
 
+  // Binds this render frame's service registry to a handle to the remote
+  // service registry.
+  void BindServiceRegistry(
+      mojo::ScopedMessagePipeHandle service_provider_handle);
+
  protected:
   RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id);
 
@@ -631,6 +638,8 @@
   // The geolocation dispatcher attached to this view, lazily initialized.
   GeolocationDispatcher* geolocation_dispatcher_;
 
+  ServiceRegistryImpl service_registry_;
+
   // The screen orientation dispatcher attached to the view, lazily initialized.
   ScreenOrientationDispatcher* screen_orientation_dispatcher_;