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

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

Issue 861683003: Move services code brought in from Mojo to live under //third_party. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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
« no previous file with comments | « mojo/services/public/js/service_provider.js ('k') | mojo/services/public/sky/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 define("mojo/services/public/js/shell", [
6 "mojo/public/js/bindings",
7 "mojo/public/js/core",
8 "mojo/public/js/connection",
9 "mojo/public/interfaces/application/shell.mojom",
10 "mojo/public/interfaces/application/service_provider.mojom",
11 "mojo/services/public/js/service_provider","console",
12 ], function(bindings, core, connection, shellMojom, spMojom, sp, console) {
13
14 const ProxyBindings = bindings.ProxyBindings;
15 const StubBindings = bindings.StubBindings;
16 const ServiceProvider = sp.ServiceProvider;
17 const ServiceProviderInterface = spMojom.ServiceProvider;
18 const ShellInterface = shellMojom.Shell;
19
20 class Shell {
21 constructor(shellProxy) {
22 this.shellProxy = shellProxy;
23 this.applications_ = new Map();
24 }
25
26 connectToApplication(url) {
27 var application = this.applications_.get(url);
28 if (application)
29 return application;
30
31 var application = new ServiceProvider();
32 this.shellProxy.connectToApplication(url,
33 function(services) {
34 application.proxy = services;
35 },
36 application);
37 this.applications_.set(url, application);
38 return application;
39 }
40
41 connectToService(url, service, client) {
42 return this.connectToApplication(url).requestService(service, client);
43 };
44
45 close() {
46 this.applications_.forEach(function(application, url) {
47 application.close();
48 });
49 ProxyBindings(this.shellProxy).close();
50 this.applications_.clear();
51 }
52 }
53
54 var exports = {};
55 exports.Shell = Shell;
56 return exports;
57 });
OLDNEW
« no previous file with comments | « mojo/services/public/js/service_provider.js ('k') | mojo/services/public/sky/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698