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 | |
121 // Initiate shutdown of this application. This may involve a round trip to the | 117 // Initiate shutdown of this application. This may involve a round trip to the |
122 // Shell to ensure there are no inbound service requests. | 118 // Shell to ensure there are no inbound service requests. |
123 void Quit(); | 119 void Quit(); |
124 | 120 |
125 private: | 121 private: |
126 // Application implementation. | 122 // Application implementation. |
127 void Initialize(ShellPtr shell, const mojo::String& url) override; | 123 void Initialize(ShellPtr shell, const mojo::String& url) override; |
128 void AcceptConnection(const String& requestor_url, | 124 void AcceptConnection(const String& requestor_url, |
129 InterfaceRequest<ServiceProvider> services, | 125 InterfaceRequest<ServiceProvider> services, |
130 ServiceProviderPtr exposed_services, | 126 ServiceProviderPtr exposed_services, |
(...skipping 24 matching lines...) Expand all Loading... |
155 AppLifetimeHelper app_lifetime_helper_; | 151 AppLifetimeHelper app_lifetime_helper_; |
156 bool quit_requested_; | 152 bool quit_requested_; |
157 base::WeakPtrFactory<ApplicationImpl> weak_factory_; | 153 base::WeakPtrFactory<ApplicationImpl> weak_factory_; |
158 | 154 |
159 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); | 155 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); |
160 }; | 156 }; |
161 | 157 |
162 } // namespace mojo | 158 } // namespace mojo |
163 | 159 |
164 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ | 160 #endif // MOJO_APPLICATION_PUBLIC_CPP_APPLICATION_IMPL_H_ |
OLD | NEW |