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 #ifndef MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ | 5 #ifndef MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ |
6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ | 6 #define MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 template <typename Interface> | 107 template <typename Interface> |
108 void ConnectToService(mojo::URLRequestPtr request, | 108 void ConnectToService(mojo::URLRequestPtr request, |
109 InterfacePtr<Interface>* ptr) { | 109 InterfacePtr<Interface>* ptr) { |
110 scoped_ptr<ApplicationConnection> connection = | 110 scoped_ptr<ApplicationConnection> connection = |
111 ConnectToApplication(request.Pass()); | 111 ConnectToApplication(request.Pass()); |
112 if (!connection.get()) | 112 if (!connection.get()) |
113 return; | 113 return; |
114 connection->ConnectToService(ptr); | 114 connection->ConnectToService(ptr); |
115 } | 115 } |
116 | 116 |
| 117 // Block the calling thread until the Initialize() method is called by the |
| 118 // shell. |
| 119 void WaitForInitialize(); |
| 120 |
117 // Initiate shutdown of this application. This may involve a round trip to the | 121 // Initiate shutdown of this application. This may involve a round trip to the |
118 // Shell to ensure there are no inbound service requests. | 122 // Shell to ensure there are no inbound service requests. |
119 void Quit(); | 123 void Quit(); |
120 | 124 |
121 private: | 125 private: |
122 // Application implementation. | 126 // Application implementation. |
123 void Initialize(ShellPtr shell, const mojo::String& url) override; | 127 void Initialize(ShellPtr shell, const mojo::String& url) override; |
124 void AcceptConnection(const String& requestor_url, | 128 void AcceptConnection(const String& requestor_url, |
125 InterfaceRequest<ServiceProvider> services, | 129 InterfaceRequest<ServiceProvider> services, |
126 ServiceProviderPtr exposed_services, | 130 ServiceProviderPtr exposed_services, |
(...skipping 24 matching lines...) Expand all Loading... |
151 AppLifetimeHelper app_lifetime_helper_; | 155 AppLifetimeHelper app_lifetime_helper_; |
152 bool quit_requested_; | 156 bool quit_requested_; |
153 base::WeakPtrFactory<ApplicationImpl> weak_factory_; | 157 base::WeakPtrFactory<ApplicationImpl> weak_factory_; |
154 | 158 |
155 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); | 159 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); |
156 }; | 160 }; |
157 | 161 |
158 } // namespace mojo | 162 } // namespace mojo |
159 | 163 |
160 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ | 164 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ |
OLD | NEW |