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

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

Powered by Google App Engine
This is Rietveld 408576698