| OLD | NEW |
| 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", | 6 "mojo/public/js/bindings", |
| 7 "mojo/public/js/core", | 7 "mojo/public/js/core", |
| 8 "mojo/public/js/connection", | 8 "mojo/public/js/connection", |
| 9 "mojo/public/js/threading", | 9 "mojo/public/js/threading", |
| 10 "mojo/public/interfaces/application/application.mojom", | 10 "mojo/public/interfaces/application/application.mojom", |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 this.shell = new Shell(shellProxy); | 35 this.shell = new Shell(shellProxy); |
| 36 this.initialize(args); | 36 this.initialize(args); |
| 37 } | 37 } |
| 38 | 38 |
| 39 initialize(args) { | 39 initialize(args) { |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Implements AcceptConnection() from Application.mojom. Calls | 42 // Implements AcceptConnection() from Application.mojom. Calls |
| 43 // this.acceptConnection() with a JS ServiceExchange instead of a pair | 43 // this.acceptConnection() with a JS ServiceExchange instead of a pair |
| 44 // of Mojo ServiceProviders. | 44 // of Mojo ServiceProviders. |
| 45 doAcceptConnection(requestorUrl, servicesRequest) { | 45 // TODO(vtl): Do something with resolvedUrl. |
| 46 doAcceptConnection(requestorUrl, resolvedUrl, servicesRequest) { |
| 46 var serviceExchange = new ServiceExchange(servicesRequest); | 47 var serviceExchange = new ServiceExchange(servicesRequest); |
| 47 this.serviceExchanges.push(serviceExchange); | 48 this.serviceExchanges.push(serviceExchange); |
| 48 this.acceptConnection(requestorUrl, serviceExchange); | 49 this.acceptConnection(requestorUrl, serviceExchange); |
| 49 } | 50 } |
| 50 | 51 |
| 51 // Subclasses override this method to request or provide services for | 52 // Subclasses override this method to request or provide services for |
| 52 // ConnectToApplication() calls from requestorURL. | 53 // ConnectToApplication() calls from requestorURL. |
| 53 acceptConnection(requestorUrl, serviceExchange) { | 54 acceptConnection(requestorUrl, serviceExchange) { |
| 54 } | 55 } |
| 55 | 56 |
| 56 quit() { | 57 quit() { |
| 57 this.serviceExchanges.forEach(function(exch) { | 58 this.serviceExchanges.forEach(function(exch) { |
| 58 exch.close(); | 59 exch.close(); |
| 59 }); | 60 }); |
| 60 this.shell.close(); | 61 this.shell.close(); |
| 61 core.close(this.appRequestHandle_); | 62 core.close(this.appRequestHandle_); |
| 62 threading.quit(); | 63 threading.quit(); |
| 63 } | 64 } |
| 64 } | 65 } |
| 65 | 66 |
| 66 var exports = {}; | 67 var exports = {}; |
| 67 exports.Application = Application; | 68 exports.Application = Application; |
| 68 return exports; | 69 return exports; |
| 69 }); | 70 }); |
| OLD | NEW |