Remove [Client=] annotation from ServiceProvider

This removes the symmetrical nature of ServiceProvider and consistently
passes and uses a ServiceProvider + ServiceProvider& pair in places that
wish to bidirectionally expose services, such as the view manager.

The
view manager library now deals with InterfaceRequest<ServiceProvider>
and ServiceProviderPtr objects (i.e. c++ wrappers for handles) instead
of a concrete implementation of ServiceProvider to make it easier for
callers.

A number of places that were assuming a particular
ServiceProvider would always exist are updated to reflect the nullability
of the parameters in mojom and places that do not wish to ever look up
or provide services now pass nullptr instead of doomed pipe handles.

The JS application startup classes are reworked a bit to accomodate
exposing services on the third ConnectToApplication/AcceptConnection
parameter.

BUG=449432
R=abarth@chromium.org, sky@chromium.org

Review URL: https://codereview.chromium.org/858103002
diff --git a/services/window_manager/window_manager_app.cc b/services/window_manager/window_manager_app.cc
index da49468..6177679 100644
--- a/services/window_manager/window_manager_app.cc
+++ b/services/window_manager/window_manager_app.cc
@@ -43,7 +43,8 @@
 // ViewManager.
 struct WindowManagerApp::PendingEmbed {
   mojo::String url;
-  mojo::InterfaceRequest<ServiceProvider> service_provider;
+  mojo::InterfaceRequest<ServiceProvider> services;
+  mojo::ServiceProviderPtr exposed_services;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -123,14 +124,17 @@
 
 void WindowManagerApp::Embed(
     const mojo::String& url,
-    mojo::InterfaceRequest<ServiceProvider> service_provider) {
+    mojo::InterfaceRequest<mojo::ServiceProvider> services,
+    mojo::ServiceProviderPtr exposed_services) {
   if (view_manager()) {
-    window_manager_delegate_->Embed(url, service_provider.Pass());
+    window_manager_delegate_->Embed(url, services.Pass(),
+                                    exposed_services.Pass());
     return;
   }
   scoped_ptr<PendingEmbed> pending_embed(new PendingEmbed);
   pending_embed->url = url;
-  pending_embed->service_provider = service_provider.Pass();
+  pending_embed->services = services.Pass();
+  pending_embed->exposed_services = exposed_services.Pass();
   pending_embeds_.push_back(pending_embed.release());
 }
 
@@ -151,9 +155,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 // WindowManagerApp, ViewManagerDelegate implementation:
 
-void WindowManagerApp::OnEmbed(View* root,
-                               mojo::ServiceProviderImpl* exported_services,
-                               scoped_ptr<ServiceProvider> imported_services) {
+void WindowManagerApp::OnEmbed(
+    View* root,
+    mojo::InterfaceRequest<mojo::ServiceProvider> services,
+    mojo::ServiceProviderPtr exposed_services) {
   DCHECK(!root_);
   root_ = root;
 
@@ -162,12 +167,14 @@
   RegisterSubtree(root_);
 
   if (wrapped_view_manager_delegate_) {
-    wrapped_view_manager_delegate_->OnEmbed(root, exported_services,
-                                            imported_services.Pass());
+    wrapped_view_manager_delegate_->OnEmbed(root, services.Pass(),
+                                            exposed_services.Pass());
   }
 
-  for (PendingEmbed* pending_embed : pending_embeds_)
-    Embed(pending_embed->url, pending_embed->service_provider.Pass());
+  for (PendingEmbed* pending_embed : pending_embeds_) {
+    Embed(pending_embed->url, pending_embed->services.Pass(),
+          pending_embed->exposed_services.Pass());
+  }
   pending_embeds_.clear();
 }