Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: shell/application_manager/application_manager.h

Issue 1682113003: Mojo C++ bindings: Generate InterfaceHandle<> instead of InterfacePtr<>. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 5 #ifndef SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
6 #define SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 6 #define SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "mojo/public/cpp/bindings/interface_handle.h"
14 #include "mojo/public/cpp/bindings/interface_request.h" 15 #include "mojo/public/cpp/bindings/interface_request.h"
15 #include "mojo/public/interfaces/application/application.mojom.h" 16 #include "mojo/public/interfaces/application/application.mojom.h"
16 #include "mojo/public/interfaces/application/service_provider.mojom.h" 17 #include "mojo/public/interfaces/application/service_provider.mojom.h"
17 #include "mojo/services/network/interfaces/network_service.mojom.h" 18 #include "mojo/services/network/interfaces/network_service.mojom.h"
18 #include "mojo/services/url_response_disk_cache/interfaces/url_response_disk_cac he.mojom.h" 19 #include "mojo/services/url_response_disk_cache/interfaces/url_response_disk_cac he.mojom.h"
19 #include "shell/application_manager/application_loader.h" 20 #include "shell/application_manager/application_loader.h"
20 #include "shell/application_manager/identity.h" 21 #include "shell/application_manager/identity.h"
21 #include "shell/application_manager/native_application_options.h" 22 #include "shell/application_manager/native_application_options.h"
22 #include "shell/application_manager/native_runner.h" 23 #include "shell/application_manager/native_runner.h"
23 #include "shell/native_application_support.h" 24 #include "shell/native_application_support.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 }; 75 };
75 76
76 ApplicationManager(const Options& options, Delegate* delegate); 77 ApplicationManager(const Options& options, Delegate* delegate);
77 ~ApplicationManager(); 78 ~ApplicationManager();
78 79
79 // Loads a service if necessary and establishes a new client connection. 80 // Loads a service if necessary and establishes a new client connection.
80 void ConnectToApplication( 81 void ConnectToApplication(
81 const GURL& application_url, 82 const GURL& application_url,
82 const GURL& requestor_url, 83 const GURL& requestor_url,
83 mojo::InterfaceRequest<mojo::ServiceProvider> services, 84 mojo::InterfaceRequest<mojo::ServiceProvider> services,
84 mojo::ServiceProviderPtr exposed_services, 85 mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services,
85 const base::Closure& on_application_end); 86 const base::Closure& on_application_end);
86 87
87 template <typename Interface> 88 template <typename Interface>
88 inline void ConnectToService(const GURL& application_url, 89 inline void ConnectToService(const GURL& application_url,
89 mojo::InterfacePtr<Interface>* ptr) { 90 mojo::InterfacePtr<Interface>* ptr) {
90 mojo::ScopedMessagePipeHandle service_handle = 91 mojo::ScopedMessagePipeHandle service_handle =
91 ConnectToServiceByName(application_url, Interface::Name_); 92 ConnectToServiceByName(application_url, Interface::Name_);
92 ptr->Bind(mojo::InterfaceHandle<Interface>(service_handle.Pass(), 0u)); 93 ptr->Bind(mojo::InterfaceHandle<Interface>(service_handle.Pass(), 0u));
93 } 94 }
94 95
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 using IdentityToContentHandlerMap = 150 using IdentityToContentHandlerMap =
150 std::map<Identity, scoped_ptr<ContentHandlerConnection>>; 151 std::map<Identity, scoped_ptr<ContentHandlerConnection>>;
151 using URLToArgsMap = std::map<GURL, std::vector<std::string>>; 152 using URLToArgsMap = std::map<GURL, std::vector<std::string>>;
152 using MimeTypeToURLMap = std::map<std::string, GURL>; 153 using MimeTypeToURLMap = std::map<std::string, GURL>;
153 using URLToNativeOptionsMap = std::map<GURL, NativeApplicationOptions>; 154 using URLToNativeOptionsMap = std::map<GURL, NativeApplicationOptions>;
154 155
155 void ConnectToApplicationWithParameters( 156 void ConnectToApplicationWithParameters(
156 const GURL& application_url, 157 const GURL& application_url,
157 const GURL& requestor_url, 158 const GURL& requestor_url,
158 mojo::InterfaceRequest<mojo::ServiceProvider> services, 159 mojo::InterfaceRequest<mojo::ServiceProvider> services,
159 mojo::ServiceProviderPtr exposed_services, 160 mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services,
160 const base::Closure& on_application_end, 161 const base::Closure& on_application_end,
161 const std::vector<std::string>& pre_redirect_parameters); 162 const std::vector<std::string>& pre_redirect_parameters);
162 163
163 bool ConnectToRunningApplication( 164 bool ConnectToRunningApplication(
164 const GURL& resolved_url, 165 const GURL& resolved_url,
165 const GURL& requestor_url, 166 const GURL& requestor_url,
166 mojo::InterfaceRequest<mojo::ServiceProvider>* services, 167 mojo::InterfaceRequest<mojo::ServiceProvider>* services,
167 mojo::ServiceProviderPtr* exposed_services); 168 mojo::InterfaceHandle<mojo::ServiceProvider>* exposed_services);
168 169
169 bool ConnectToApplicationWithLoader( 170 bool ConnectToApplicationWithLoader(
170 const GURL& resolved_url, 171 const GURL& resolved_url,
171 const GURL& requestor_url, 172 const GURL& requestor_url,
172 mojo::InterfaceRequest<mojo::ServiceProvider>* services, 173 mojo::InterfaceRequest<mojo::ServiceProvider>* services,
173 mojo::ServiceProviderPtr* exposed_services, 174 mojo::InterfaceHandle<mojo::ServiceProvider>* exposed_services,
174 const base::Closure& on_application_end, 175 const base::Closure& on_application_end,
175 const std::vector<std::string>& parameters, 176 const std::vector<std::string>& parameters,
176 ApplicationLoader* loader); 177 ApplicationLoader* loader);
177 178
178 // Creates an Identity for the service identified by |resolved_url|. 179 // Creates an Identity for the service identified by |resolved_url|.
179 // If |new_process_per_connection| is true for the URL's options, then the 180 // If |new_process_per_connection| is true for the URL's options, then the
180 // identity is unique. Otherwise, repeated invocations with the same 181 // identity is unique. Otherwise, repeated invocations with the same
181 // |resolved_url| will result in an equivalent Identity. If |strip_query| is 182 // |resolved_url| will result in an equivalent Identity. If |strip_query| is
182 // true, the query is stripped before creating the Identity. 183 // true, the query is stripped before creating the Identity.
183 Identity MakeApplicationIdentity(const GURL& resolved_url, 184 Identity MakeApplicationIdentity(const GURL& resolved_url,
184 bool strip_query = true); 185 bool strip_query = true);
185 186
186 mojo::InterfaceRequest<mojo::Application> RegisterShell( 187 mojo::InterfaceRequest<mojo::Application> RegisterShell(
187 // The URL after resolution and redirects, including the querystring. 188 // The URL after resolution and redirects, including the querystring.
188 const GURL& resolved_url, 189 const GURL& resolved_url,
189 const GURL& requestor_url, 190 const GURL& requestor_url,
190 mojo::InterfaceRequest<mojo::ServiceProvider> services, 191 mojo::InterfaceRequest<mojo::ServiceProvider> services,
191 mojo::ServiceProviderPtr exposed_services, 192 mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services,
192 const base::Closure& on_application_end, 193 const base::Closure& on_application_end,
193 const std::vector<std::string>& parameters); 194 const std::vector<std::string>& parameters);
194 195
195 ShellImpl* GetShellImpl(const GURL& url); 196 ShellImpl* GetShellImpl(const GURL& url);
196 197
197 void ConnectToClient(ShellImpl* shell_impl, 198 void ConnectToClient(
198 const GURL& resolved_url, 199 ShellImpl* shell_impl,
199 const GURL& requestor_url, 200 const GURL& resolved_url,
200 mojo::InterfaceRequest<mojo::ServiceProvider> services, 201 const GURL& requestor_url,
201 mojo::ServiceProviderPtr exposed_services); 202 mojo::InterfaceRequest<mojo::ServiceProvider> services,
203 mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services);
202 204
203 void HandleFetchCallback( 205 void HandleFetchCallback(
204 const GURL& requestor_url, 206 const GURL& requestor_url,
205 mojo::InterfaceRequest<mojo::ServiceProvider> services, 207 mojo::InterfaceRequest<mojo::ServiceProvider> services,
206 mojo::ServiceProviderPtr exposed_services, 208 mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services,
207 const base::Closure& on_application_end, 209 const base::Closure& on_application_end,
208 const std::vector<std::string>& parameters, 210 const std::vector<std::string>& parameters,
209 scoped_ptr<Fetcher> fetcher); 211 scoped_ptr<Fetcher> fetcher);
210 212
211 void RunNativeApplication( 213 void RunNativeApplication(
212 mojo::InterfaceRequest<mojo::Application> application_request, 214 mojo::InterfaceRequest<mojo::Application> application_request,
213 const NativeApplicationOptions& options, 215 const NativeApplicationOptions& options,
214 scoped_ptr<Fetcher> fetcher, 216 scoped_ptr<Fetcher> fetcher,
215 const base::FilePath& file_path, 217 const base::FilePath& file_path,
216 bool path_exists); 218 bool path_exists);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 ScopedVector<NativeRunner> native_runners_; 257 ScopedVector<NativeRunner> native_runners_;
256 bool initialized_authentication_interceptor_; 258 bool initialized_authentication_interceptor_;
257 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; 259 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_;
258 260
259 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); 261 DISALLOW_COPY_AND_ASSIGN(ApplicationManager);
260 }; 262 };
261 263
262 } // namespace shell 264 } // namespace shell
263 265
264 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 266 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698