| Index: third_party/mojo_services/src/public/js/application.js
|
| diff --git a/third_party/mojo_services/src/public/js/application.js b/third_party/mojo_services/src/public/js/application.js
|
| index aea60fdd36d968d85964bf8731d8c9b1c3257769..d4aa1e674236691fa1643ee8966f42f5fb6ebe2b 100644
|
| --- a/third_party/mojo_services/src/public/js/application.js
|
| +++ b/third_party/mojo_services/src/public/js/application.js
|
| @@ -8,19 +8,20 @@ define("mojo/services/public/js/application", [
|
| "mojo/public/js/connection",
|
| "mojo/public/js/threading",
|
| "mojo/public/interfaces/application/application.mojom",
|
| - "mojo/services/public/js/service_exchange",
|
| + "mojo/services/public/js/service_provider",
|
| "mojo/services/public/js/shell",
|
| -], function(bindings, core, connection, threading, applicationMojom, serviceExchange, shell) {
|
| +], function(bindings, core, connection, threading, applicationMojom, serviceProvider, shell) {
|
|
|
| const ApplicationInterface = applicationMojom.Application;
|
| const ProxyBindings = bindings.ProxyBindings;
|
| - const ServiceExchange = serviceExchange.ServiceExchange;
|
| + const ServiceProvider = serviceProvider.ServiceProvider;
|
| const Shell = shell.Shell;
|
|
|
| class Application {
|
| constructor(appRequestHandle, url) {
|
| this.url = url;
|
| - this.serviceExchanges = [];
|
| + this.serviceProviders = [];
|
| + this.exposedServiceProviders = [];
|
| this.appRequestHandle_ = appRequestHandle;
|
| this.appStub_ =
|
| connection.bindHandleToStub(appRequestHandle, ApplicationInterface);
|
| @@ -36,27 +37,30 @@ define("mojo/services/public/js/application", [
|
| this.initialize(args);
|
| }
|
|
|
| - initialize(args) {
|
| - }
|
| + initialize(args) {}
|
|
|
| - // Implements AcceptConnection() from Application.mojom. Calls
|
| - // this.acceptConnection() with a JS ServiceExchange instead of a pair
|
| - // of Mojo ServiceProviders.
|
| + // The mojom signature of this function is:
|
| + // AcceptConnection(string requestor_url,
|
| + // ServiceProvider&? services,
|
| + // ServiceProvider? exposed_services);
|
| + //
|
| + // We want to bind |services| to our js implementation of ServiceProvider
|
| + // and store |exposed_services| so we can request services of the connecting
|
| + // application.
|
| doAcceptConnection(requestorUrl, servicesRequest, exposedServicesProxy) {
|
| - var serviceExchange =
|
| - new ServiceExchange(servicesRequest, exposedServicesProxy);
|
| - this.serviceExchanges.push(serviceExchange);
|
| - this.acceptConnection(requestorUrl, serviceExchange);
|
| + // Construct a new js ServiceProvider that can make outgoing calls on
|
| + // exposedServicesProxy.
|
| + var serviceProvider =
|
| + new ServiceProvider(servicesRequest, exposedServicesProxy);
|
| + this.serviceProviders.push(serviceProvider);
|
| + this.acceptConnection(requestorUrl, serviceProvider);
|
| }
|
|
|
| - // Subclasses override this method to request or provide services for
|
| - // ConnectToApplication() calls from requestorURL.
|
| - acceptConnection(requestorUrl, serviceExchange) {
|
| - }
|
| + acceptConnection(requestorUrl, serviceProvider) {}
|
|
|
| quit() {
|
| - this.serviceExchanges.forEach(function(exch) {
|
| - exch.close();
|
| + this.serviceProviders.forEach(function(sp) {
|
| + sp.close();
|
| });
|
| this.shell.close();
|
| core.close(this.appRequestHandle_);
|
|
|