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 part of application; | 5 part of application; |
6 | 6 |
7 class _ApplicationImpl implements application_mojom.Application { | 7 class _ApplicationImpl implements application_mojom.Application { |
8 application_mojom.ApplicationStub _stub; | 8 application_mojom.ApplicationStub _stub; |
9 shell_mojom.ShellProxy shell; | 9 shell_mojom.ShellProxy shell; |
10 Application _application; | 10 Application _application; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 close(); | 91 close(); |
92 } | 92 } |
93 | 93 |
94 void close() { | 94 void close() { |
95 assert(_applicationImpl != null); | 95 assert(_applicationImpl != null); |
96 _applicationConnections.forEach((c) => c.close()); | 96 _applicationConnections.forEach((c) => c.close()); |
97 _applicationConnections.clear(); | 97 _applicationConnections.clear(); |
98 _applicationImpl.close(); | 98 _applicationImpl.close(); |
99 } | 99 } |
100 | 100 |
| 101 // This method closes all the application connections. Used during apptesting. |
| 102 resetConnections() { |
| 103 assert(_applicationImpl != null); |
| 104 _applicationConnections.forEach((c) => c.close()); |
| 105 _applicationConnections.clear(); |
| 106 } |
| 107 |
101 void _acceptConnection(String requestorUrl, ServiceProviderStub services, | 108 void _acceptConnection(String requestorUrl, ServiceProviderStub services, |
102 ServiceProviderProxy exposedServices, String resolvedUrl) { | 109 ServiceProviderProxy exposedServices, String resolvedUrl) { |
103 var connection = new ApplicationConnection(services, exposedServices); | 110 var connection = new ApplicationConnection(services, exposedServices); |
104 _applicationConnections.add(connection); | 111 _applicationConnections.add(connection); |
105 acceptConnection(requestorUrl, resolvedUrl, connection); | 112 acceptConnection(requestorUrl, resolvedUrl, connection); |
106 } | 113 } |
107 | 114 |
108 // Override this method to provide services on |connection|. | 115 // Override this method to provide services on |connection|. |
109 // If you provide at least one service or set fallbackServiceProvider, | 116 // If you provide at least one service or set fallbackServiceProvider, |
110 // then you must invoke connection.listen(). | 117 // then you must invoke connection.listen(). |
111 void acceptConnection(String requestorUrl, String resolvedUrl, | 118 void acceptConnection(String requestorUrl, String resolvedUrl, |
112 ApplicationConnection connection) { | 119 ApplicationConnection connection) { |
113 } | 120 } |
114 } | 121 } |
OLD | NEW |