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

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

Issue 868463008: Remove Client relationship between mojo.Shell/mojo.Application (Closed) Base URL: git@github.com:domokit/mojo.git@app_impl_init
Patch Set: 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/core",
8 "mojo/public/js/connection",
6 "mojo/public/js/threading", 9 "mojo/public/js/threading",
10 "mojo/public/interfaces/application/application.mojom",
7 "mojo/services/public/js/service_provider", 11 "mojo/services/public/js/service_provider",
8 "mojo/services/public/js/shell", 12 "mojo/services/public/js/shell",
9 ], function(threading, serviceProvider, shell) { 13 ], function(bindings, core, connection, threading, applicationMojom,
14 serviceProvider, shell) {
jamesr 2015/01/26 23:19:49 hah! line wrapping this (to make the 80col presubm
10 15
16 const ApplicationInterface = applicationMojom.Application;
17 const ProxyBindings = bindings.ProxyBindings;
11 const ServiceProvider = serviceProvider.ServiceProvider; 18 const ServiceProvider = serviceProvider.ServiceProvider;
12 const Shell = shell.Shell; 19 const Shell = shell.Shell;
13 20
14 class Application { 21 class Application {
15 constructor(shellHandle, url) { 22 constructor(appRequestHandle, url) {
16 this.url = url; 23 this.url = url;
17 this.serviceProviders = []; 24 this.serviceProviders = [];
18 this.exposedServiceProviders = []; 25 this.exposedServiceProviders = [];
19 this.shellHandle_ = shellHandle; 26 this.appRequestHandle_ = appRequestHandle;
20 this.shell = new Shell(shellHandle, { 27 this.appStub_ =
21 initialize: this.initialize.bind(this), 28 connection.bindHandleToStub(appRequestHandle, ApplicationInterface);
22 acceptConnection: this.doAcceptConnection.bind(this), 29 bindings.StubBindings(this.appStub_).delegate = {
23 }); 30 initialize: this.doInitialize.bind(this),
31 acceptConnection: this.doAcceptConnection.bind(this),
32 };
24 } 33 }
25 34
26 initialize(args) { 35 doInitialize(shellProxy, args) {
36 this.shellProxy_ = shellProxy;
37 this.shell = new Shell(shellProxy);
38 this.initialize(args);
27 } 39 }
28 40
41 initialize(args) {}
42
29 // The mojom signature of this function is: 43 // The mojom signature of this function is:
30 // AcceptConnection(string requestor_url, 44 // AcceptConnection(string requestor_url,
31 // ServiceProvider&? services, 45 // ServiceProvider&? services,
32 // ServiceProvider? exposed_services); 46 // ServiceProvider? exposed_services);
33 // 47 //
34 // We want to bind |services| to our js implementation of ServiceProvider 48 // We want to bind |services| to our js implementation of ServiceProvider
35 // and store |exposed_services| so we can request services of the connecting 49 // and store |exposed_services| so we can request services of the connecting
36 // application. 50 // application.
37 doAcceptConnection(requestorUrl, servicesRequest, exposedServicesProxy) { 51 doAcceptConnection(requestorUrl, servicesRequest, exposedServicesProxy) {
38 // Construct a new js ServiceProvider that can make outgoing calls on 52 // Construct a new js ServiceProvider that can make outgoing calls on
39 // exposedServicesProxy. 53 // exposedServicesProxy.
40 var serviceProvider = 54 var serviceProvider =
41 new ServiceProvider(servicesRequest, exposedServicesProxy); 55 new ServiceProvider(servicesRequest, exposedServicesProxy);
42 this.serviceProviders.push(serviceProvider); 56 this.serviceProviders.push(serviceProvider);
43 this.acceptConnection(requestorUrl, serviceProvider); 57 this.acceptConnection(requestorUrl, serviceProvider);
44 } 58 }
45 59
46 acceptConnection(requestorUrl, serviceProvider) { 60 acceptConnection(requestorUrl, serviceProvider) {}
47 }
48 61
49 quit() { 62 quit() {
50 this.serviceProviders.forEach(function(sp) { 63 this.serviceProviders.forEach(function(sp) {
51 sp.close(); 64 sp.close();
52 }); 65 });
53 this.shell.close(); 66 this.shell.close();
67 core.close(this.appRequestHandle_);
54 threading.quit(); 68 threading.quit();
55 } 69 }
56 } 70 }
57 71
58 var exports = {}; 72 var exports = {};
59 exports.Application = Application; 73 exports.Application = Application;
60 return exports; 74 return exports;
61 }); 75 });
OLDNEW
« no previous file with comments | « mojo/services/content_handler/public/interfaces/content_handler.mojom ('k') | mojo/services/public/js/shell.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698