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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 }); | 124 }); |
125 } | 125 } |
126 | 126 |
127 void close() { | 127 void close() { |
128 assert(_applicationImpl != null); | 128 assert(_applicationImpl != null); |
129 _applicationConnections.forEach((c) => c.close()); | 129 _applicationConnections.forEach((c) => c.close()); |
130 _applicationConnections.clear(); | 130 _applicationConnections.clear(); |
131 _applicationImpl.close(); | 131 _applicationImpl.close(); |
132 } | 132 } |
133 | 133 |
| 134 // This method closes all the application connections. Used during apptesting. |
| 135 resetConnections() { |
| 136 assert(_applicationImpl != null); |
| 137 _applicationConnections.forEach((c) => c.close()); |
| 138 _applicationConnections.clear(); |
| 139 } |
| 140 |
134 void _acceptConnection(String requestorUrl, ServiceProviderStub services, | 141 void _acceptConnection(String requestorUrl, ServiceProviderStub services, |
135 ServiceProviderProxy exposedServices, String resolvedUrl) { | 142 ServiceProviderProxy exposedServices, String resolvedUrl) { |
136 var connection = new ApplicationConnection(services, exposedServices); | 143 var connection = new ApplicationConnection(services, exposedServices); |
137 _applicationConnections.add(connection); | 144 _applicationConnections.add(connection); |
138 acceptConnection(requestorUrl, resolvedUrl, connection); | 145 acceptConnection(requestorUrl, resolvedUrl, connection); |
139 } | 146 } |
140 | 147 |
141 // Override this method to provide services on |connection|. | 148 // Override this method to provide services on |connection|. |
142 // If you provide at least one service or set fallbackServiceProvider, | 149 // If you provide at least one service or set fallbackServiceProvider, |
143 // then you must invoke connection.listen(). | 150 // then you must invoke connection.listen(). |
144 void acceptConnection(String requestorUrl, String resolvedUrl, | 151 void acceptConnection(String requestorUrl, String resolvedUrl, |
145 ApplicationConnection connection) { | 152 ApplicationConnection connection) { |
146 } | 153 } |
147 } | 154 } |
OLD | NEW |