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

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

Issue 799113004: Update mojo sdk to rev 59145288bae55b0fce4276b017df6a1117bcf00f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add mojo's ply to checklicenses whitelist Created 6 years 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/shell", [ 5 define("mojo/services/public/js/shell", [
6 "mojo/public/js/core",
7 "mojo/public/interfaces/application/shell.mojom",
6 "mojo/public/interfaces/application/service_provider.mojom", 8 "mojo/public/interfaces/application/service_provider.mojom",
7 "mojo/services/public/js/service_provider", 9 "mojo/services/public/js/service_provider",
8 ], function(spInterfaceModule, spModule) { 10 ], function(coreModule, shellInterfaceModule, spInterfaceModule, spModule) {
9 11
10 class Shell { 12 class Shell {
11 constructor(appShell) { 13 constructor(shellHandle, app) {
12 this.appShell_ = appShell; 14 this.shellHandle = shellHandle;
15 this.proxy = new shellInterfaceModule.Shell.proxyClass(shellHandle);
16 this.proxy.client$ = app;
13 this.applications_ = new Map(); 17 this.applications_ = new Map();
14 } 18 }
15 19
16 connectToApplication(url) { 20 connectToApplication(url) {
17 var application = this.applications_.get(url); 21 var application = this.applications_.get(url);
18 if (application) 22 if (application)
19 return application; 23 return application;
20 24
21 var proxy = new spInterfaceModule.ServiceProvider.proxyClass; 25 var spProxy = new spInterfaceModule.ServiceProvider.proxyClass;
22 this.appShell_.connectToApplication(url, proxy); 26 this.proxy.connectToApplication(url, spProxy);
23 application = new spModule.ServiceProvider(proxy); 27 application = new spModule.ServiceProvider(spProxy);
24 this.applications_.set(url, application); 28 this.applications_.set(url, application);
25 return application; 29 return application;
26 } 30 }
27 31
28 connectToService(url, service, client) { 32 connectToService(url, service, client) {
29 return this.connectToApplication(url).connectToService(service, client); 33 return this.connectToApplication(url).connectToService(service, client);
30 }; 34 };
31 35
32 close() { 36 close() {
33 this.applications_.forEach(function(application, url) { 37 this.applications_.forEach(function(application, url) {
34 application.close(); 38 application.close();
35 }); 39 });
36 this.applications_.clear(); 40 this.applications_.clear();
41 coreModule.close(this.shellHandle);
37 } 42 }
38 } 43 }
39 44
40 var exports = {}; 45 var exports = {};
41 exports.Shell = Shell; 46 exports.Shell = Shell;
42 return exports; 47 return exports;
43 }); 48 });
OLDNEW
« no previous file with comments | « mojo/services/public/js/service_provider.js ('k') | mojo/services/public/mojo_services_public.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698