Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: mojo/services/public/js/application.js

Issue 858103002: Remove [Client=] annotation from ServiceProvider (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase for trybots (no code changes from ps2) Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 define("mojo/services/public/js/application", [ 5 define("mojo/services/public/js/application", [
6 "mojo/public/js/bindings",
7 "mojo/public/js/threading",
6 "mojo/services/public/js/service_provider", 8 "mojo/services/public/js/service_provider",
7 "mojo/services/public/js/shell", 9 "mojo/services/public/js/shell",
8 "mojo/public/js/threading", 10 ], function(bindings, threading, serviceProvider, shell) {
9 ], function(serviceProvider, shell, threading) {
10 11
12 const ProxyBindings = bindings.ProxyBindings;
11 const ServiceProvider = serviceProvider.ServiceProvider; 13 const ServiceProvider = serviceProvider.ServiceProvider;
12 const Shell = shell.Shell; 14 const Shell = shell.Shell;
13 15
14 class Application { 16 class Application {
15 constructor(shellHandle, url) { 17 constructor(shellHandle, url) {
16 this.url = url; 18 this.url = url;
17 this.serviceProviders = []; 19 this.serviceProviders = [];
18 this.exposedServiceProviders = []; 20 this.exposedServiceProviders = [];
19 this.shellHandle_ = shellHandle; 21 this.shellHandle_ = shellHandle;
20 this.shell = new Shell(shellHandle, { 22 this.shell = new Shell(shellHandle, {
21 initialize: this.initialize.bind(this), 23 initialize: this.initialize.bind(this),
22 acceptConnection: this.doAcceptConnection.bind(this), 24 acceptConnection: this.doAcceptConnection.bind(this),
23 }); 25 });
24 } 26 }
25 27
26 initialize(args) { 28 initialize(args) {
27 } 29 }
28 30
29 doAcceptConnection(url, serviceProviderProxy, exposedServiceProviderProxy) { 31 // The mojom signature of this function is:
30 var serviceProvider = new ServiceProvider(serviceProviderProxy); 32 // AcceptConnection(string requestor_url,
33 // ServiceProvider&? services,
34 // ServiceProvider? exposed_services);
35 //
36 // We want to bind |services| to our js implementation of ServiceProvider
37 // and store |exposed_services| so we can request services of the connecting
38 // application.
39 doAcceptConnection(requestorUrl, servicesRequest, exposedServicesProxy) {
40 // Construct a new js ServiceProvider that can make outgoing calls on
41 // exposedServicesProxy.
42 var serviceProvider = new ServiceProvider(exposedServicesProxy);
31 this.serviceProviders.push(serviceProvider); 43 this.serviceProviders.push(serviceProvider);
32 44
33 var exposedServiceProvider = 45 // Then associate incoming calls with the serviceProvider.
34 new ServiceProvider(exposedServiceProviderProxy); 46 ProxyBindings(servicesRequest).setLocalDelegate(serviceProvider);
35 this.exposedServiceProviders.push(exposedServiceProvider);
36 47
37 this.acceptConnection(url, serviceProvider, exposedServiceProvider); 48 this.acceptConnection(requestorUrl, serviceProvider);
38 } 49 }
39 50
40 acceptConnection(url, serviceProvider, exposedServiceProvider) { 51 acceptConnection(requestorUrl, serviceProvider) {
41 } 52 }
42 53
43 quit() { 54 quit() {
44 this.serviceProviders.forEach(function(sp) { 55 this.serviceProviders.forEach(function(sp) {
45 sp.close(); 56 sp.close();
46 }); 57 });
47 this.shell.close(); 58 this.shell.close();
48 threading.quit(); 59 threading.quit();
49 } 60 }
50 } 61 }
51 62
52 var exports = {}; 63 var exports = {};
53 exports.Application = Application; 64 exports.Application = Application;
54 return exports; 65 return exports;
55 }); 66 });
OLDNEW
« no previous file with comments | « mojo/public/interfaces/application/service_provider.mojom ('k') | mojo/services/public/js/service_provider.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698