Make the Dart application library code stop using the "wrong way" service provider (a.k.a. exposed_services).

The plan is to get rid of exposed_services.

No one is *really* using exposed_services now anyway (now that tracing
no longer uses it).

So we can make connectToApplication() not bring up exposed_services.
Probably things could be refactored/cleaned up significantly once
exposed_services is gone.

(Note that some of the existing code was dubious: exposed_services is
optional, so blindly calling close() on a proxy for it was wrong.)

R=johnmccutchan@google.com, zra@google.com
BUG=#762

Review URL: https://codereview.chromium.org/1964623002 .
diff --git a/examples/dart/hello_world/hello/lib/main.dart b/examples/dart/hello_world/hello/lib/main.dart
index eb1f768..19c0e0e 100644
--- a/examples/dart/hello_world/hello/lib/main.dart
+++ b/examples/dart/hello_world/hello/lib/main.dart
@@ -29,7 +29,7 @@
     // app has a chance to come up. Instead, we wait to close this app until
     // the "world" app comes up, does its print, and closes its end of the
     // connection.
-    c.onError = closeApplication;
+    c.remoteServiceProvider.impl.onError = closeApplication;
   }
 
   Future closeApplication(e) async {
diff --git a/mojo/dart/apptests/test_apps/echo/lib/main.dart b/mojo/dart/apptests/test_apps/echo/lib/main.dart
index 4ace20a..76ad196 100644
--- a/mojo/dart/apptests/test_apps/echo/lib/main.dart
+++ b/mojo/dart/apptests/test_apps/echo/lib/main.dart
@@ -57,8 +57,6 @@
   @override
   void acceptConnection(String requestorUrl, String resolvedUrl,
       ApplicationConnection connection) {
-    // No services are required from the remote end.
-    connection.remoteServiceProvider.close();
     connection.provideService(EchoService.serviceName,
         (endpoint) => new EchoServiceImpl(this, endpoint));
   }
diff --git a/mojo/dart/apptests/test_apps/pingpong/lib/main.dart b/mojo/dart/apptests/test_apps/pingpong/lib/main.dart
index 1e0ff6f..5a3a695 100644
--- a/mojo/dart/apptests/test_apps/pingpong/lib/main.dart
+++ b/mojo/dart/apptests/test_apps/pingpong/lib/main.dart
@@ -126,9 +126,6 @@
   @override
   void acceptConnection(String requestorUrl, String resolvedUrl,
       ApplicationConnection connection) {
-    // No services are required from the remote end.
-    connection.remoteServiceProvider.close();
-
     connection.provideService(PingPongService.serviceName,
         (endpoint) => new PingPongServiceImpl(this, endpoint),
         description: PingPongServiceStub.serviceDescription);
diff --git a/mojo/dart/apptests/test_apps/pingpong_target/lib/main.dart b/mojo/dart/apptests/test_apps/pingpong_target/lib/main.dart
index 8cceaa7..5c619ef 100644
--- a/mojo/dart/apptests/test_apps/pingpong_target/lib/main.dart
+++ b/mojo/dart/apptests/test_apps/pingpong_target/lib/main.dart
@@ -56,9 +56,6 @@
     // Provide the service implemented by PingPongServiceImpl.
     connection.provideService(PingPongService.serviceName,
         (endpoint) => new PingPongServiceImpl(this, endpoint));
-
-    // No services are required from the remote end.
-    connection.remoteServiceProvider.close();
   }
 
   Future closeApplication() async {
diff --git a/mojo/dart/packages/mojo/lib/src/application.dart b/mojo/dart/packages/mojo/lib/src/application.dart
index 885996f..488127f 100644
--- a/mojo/dart/packages/mojo/lib/src/application.dart
+++ b/mojo/dart/packages/mojo/lib/src/application.dart
@@ -97,9 +97,8 @@
   // Returns a connection to the app at |url|.
   ApplicationConnection connectToApplication(String url) {
     var proxy = new ServiceProviderProxy.unbound();
-    var stub = new ServiceProviderStub.unbound();
-    _applicationImpl.shell.ptr.connectToApplication(url, proxy, stub);
-    var connection = new ApplicationConnection(stub, proxy);
+    _applicationImpl.shell.ptr.connectToApplication(url, proxy, null);
+    var connection = new ApplicationConnection(null, proxy);
     _applicationConnections.add(connection);
     return connection;
   }
diff --git a/mojo/dart/packages/mojo/lib/src/application_connection.dart b/mojo/dart/packages/mojo/lib/src/application_connection.dart
index ad0dbb0..cb89b91 100644
--- a/mojo/dart/packages/mojo/lib/src/application_connection.dart
+++ b/mojo/dart/packages/mojo/lib/src/application_connection.dart
@@ -62,6 +62,9 @@
 /// To handle requests for services beyond those set up with [provideService],
 /// set [fallbackServiceFactory] to a function that instantiates a service as in
 /// the [provideService] case, or closes the pipe.
+// TODO(vtl): Once "exposed_services" is removed from Shell's
+// ConnectToApplication() (and Application's AcceptConnection(), etc.), this
+// class will be a bit of overkill. https://github.com/domokit/mojo/issues/762
 class ApplicationConnection {
   ServiceProviderProxy remoteServiceProvider;
   LocalServiceProvider _localServiceProvider;
diff --git a/mojo/public/cpp/application/lib/application_impl.cc b/mojo/public/cpp/application/lib/application_impl.cc
index f963528..23c58ae 100644
--- a/mojo/public/cpp/application/lib/application_impl.cc
+++ b/mojo/public/cpp/application/lib/application_impl.cc
@@ -64,6 +64,8 @@
     InterfaceRequest<ServiceProvider> services,
     InterfaceHandle<ServiceProvider> exposed_services,
     const String& url) {
+  MOJO_LOG_IF(WARNING, exposed_services)
+      << "DEPRECATION WARNING: exposed_services will soon go away";
   std::unique_ptr<internal::ServiceRegistry> registry(
       new internal::ServiceRegistry(this, url, requestor_url,
                                     std::move(exposed_services),