| 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 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" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 ApplicationManager(const Options& options, Delegate* delegate); | 76 ApplicationManager(const Options& options, Delegate* delegate); |
| 77 ~ApplicationManager(); | 77 ~ApplicationManager(); |
| 78 | 78 |
| 79 // Loads a service if necessary and establishes a new client connection. | 79 // Loads a service if necessary and establishes a new client connection. |
| 80 void ConnectToApplication( | 80 void ConnectToApplication( |
| 81 const GURL& application_url, | 81 const GURL& application_url, |
| 82 const GURL& requestor_url, | 82 const GURL& requestor_url, |
| 83 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 83 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 84 mojo::ServiceProviderPtr exposed_services, | 84 mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services, |
| 85 const base::Closure& on_application_end); | 85 const base::Closure& on_application_end); |
| 86 | 86 |
| 87 template <typename Interface> | 87 template <typename Interface> |
| 88 inline void ConnectToService(const GURL& application_url, | 88 inline void ConnectToService(const GURL& application_url, |
| 89 mojo::InterfacePtr<Interface>* ptr) { | 89 mojo::InterfacePtr<Interface>* ptr) { |
| 90 mojo::ScopedMessagePipeHandle service_handle = | 90 mojo::ScopedMessagePipeHandle service_handle = |
| 91 ConnectToServiceByName(application_url, Interface::Name_); | 91 ConnectToServiceByName(application_url, Interface::Name_); |
| 92 ptr->Bind(mojo::InterfaceHandle<Interface>(service_handle.Pass(), 0u)); | 92 ptr->Bind(mojo::InterfaceHandle<Interface>(service_handle.Pass(), 0u)); |
| 93 } | 93 } |
| 94 | 94 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 using IdentityToContentHandlerMap = | 149 using IdentityToContentHandlerMap = |
| 150 std::map<Identity, scoped_ptr<ContentHandlerConnection>>; | 150 std::map<Identity, scoped_ptr<ContentHandlerConnection>>; |
| 151 using URLToArgsMap = std::map<GURL, std::vector<std::string>>; | 151 using URLToArgsMap = std::map<GURL, std::vector<std::string>>; |
| 152 using MimeTypeToURLMap = std::map<std::string, GURL>; | 152 using MimeTypeToURLMap = std::map<std::string, GURL>; |
| 153 using URLToNativeOptionsMap = std::map<GURL, NativeApplicationOptions>; | 153 using URLToNativeOptionsMap = std::map<GURL, NativeApplicationOptions>; |
| 154 | 154 |
| 155 void ConnectToApplicationWithParameters( | 155 void ConnectToApplicationWithParameters( |
| 156 const GURL& application_url, | 156 const GURL& application_url, |
| 157 const GURL& requestor_url, | 157 const GURL& requestor_url, |
| 158 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 158 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 159 mojo::ServiceProviderPtr exposed_services, | 159 mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services, |
| 160 const base::Closure& on_application_end, | 160 const base::Closure& on_application_end, |
| 161 const std::vector<std::string>& pre_redirect_parameters); | 161 const std::vector<std::string>& pre_redirect_parameters); |
| 162 | 162 |
| 163 bool ConnectToRunningApplication( | 163 bool ConnectToRunningApplication( |
| 164 const GURL& resolved_url, | 164 const GURL& resolved_url, |
| 165 const GURL& requestor_url, | 165 const GURL& requestor_url, |
| 166 mojo::InterfaceRequest<mojo::ServiceProvider>* services, | 166 mojo::InterfaceRequest<mojo::ServiceProvider>* services, |
| 167 mojo::ServiceProviderPtr* exposed_services); | 167 mojo::InterfaceHandle<mojo::ServiceProvider>* exposed_services); |
| 168 | 168 |
| 169 bool ConnectToApplicationWithLoader( | 169 bool ConnectToApplicationWithLoader( |
| 170 const GURL& resolved_url, | 170 const GURL& resolved_url, |
| 171 const GURL& requestor_url, | 171 const GURL& requestor_url, |
| 172 mojo::InterfaceRequest<mojo::ServiceProvider>* services, | 172 mojo::InterfaceRequest<mojo::ServiceProvider>* services, |
| 173 mojo::ServiceProviderPtr* exposed_services, | 173 mojo::InterfaceHandle<mojo::ServiceProvider>* exposed_services, |
| 174 const base::Closure& on_application_end, | 174 const base::Closure& on_application_end, |
| 175 const std::vector<std::string>& parameters, | 175 const std::vector<std::string>& parameters, |
| 176 ApplicationLoader* loader); | 176 ApplicationLoader* loader); |
| 177 | 177 |
| 178 // Creates an Identity for the service identified by |resolved_url|. | 178 // 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 | 179 // If |new_process_per_connection| is true for the URL's options, then the |
| 180 // identity is unique. Otherwise, repeated invocations with the same | 180 // identity is unique. Otherwise, repeated invocations with the same |
| 181 // |resolved_url| will result in an equivalent Identity. If |strip_query| is | 181 // |resolved_url| will result in an equivalent Identity. If |strip_query| is |
| 182 // true, the query is stripped before creating the Identity. | 182 // true, the query is stripped before creating the Identity. |
| 183 Identity MakeApplicationIdentity(const GURL& resolved_url, | 183 Identity MakeApplicationIdentity(const GURL& resolved_url, |
| 184 bool strip_query = true); | 184 bool strip_query = true); |
| 185 | 185 |
| 186 mojo::InterfaceRequest<mojo::Application> RegisterShell( | 186 mojo::InterfaceRequest<mojo::Application> RegisterShell( |
| 187 // The URL after resolution and redirects, including the querystring. | 187 // The URL after resolution and redirects, including the querystring. |
| 188 const GURL& resolved_url, | 188 const GURL& resolved_url, |
| 189 const GURL& requestor_url, | 189 const GURL& requestor_url, |
| 190 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 190 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 191 mojo::ServiceProviderPtr exposed_services, | 191 mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services, |
| 192 const base::Closure& on_application_end, | 192 const base::Closure& on_application_end, |
| 193 const std::vector<std::string>& parameters); | 193 const std::vector<std::string>& parameters); |
| 194 | 194 |
| 195 ShellImpl* GetShellImpl(const GURL& url); | 195 ShellImpl* GetShellImpl(const GURL& url); |
| 196 | 196 |
| 197 void ConnectToClient(ShellImpl* shell_impl, | 197 void ConnectToClient( |
| 198 const GURL& resolved_url, | 198 ShellImpl* shell_impl, |
| 199 const GURL& requestor_url, | 199 const GURL& resolved_url, |
| 200 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 200 const GURL& requestor_url, |
| 201 mojo::ServiceProviderPtr exposed_services); | 201 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 202 mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services); |
| 202 | 203 |
| 203 void HandleFetchCallback( | 204 void HandleFetchCallback( |
| 204 const GURL& requestor_url, | 205 const GURL& requestor_url, |
| 205 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 206 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 206 mojo::ServiceProviderPtr exposed_services, | 207 mojo::InterfaceHandle<mojo::ServiceProvider> exposed_services, |
| 207 const base::Closure& on_application_end, | 208 const base::Closure& on_application_end, |
| 208 const std::vector<std::string>& parameters, | 209 const std::vector<std::string>& parameters, |
| 209 scoped_ptr<Fetcher> fetcher); | 210 scoped_ptr<Fetcher> fetcher); |
| 210 | 211 |
| 211 void RunNativeApplication( | 212 void RunNativeApplication( |
| 212 mojo::InterfaceRequest<mojo::Application> application_request, | 213 mojo::InterfaceRequest<mojo::Application> application_request, |
| 213 const NativeApplicationOptions& options, | 214 const NativeApplicationOptions& options, |
| 214 scoped_ptr<Fetcher> fetcher, | 215 scoped_ptr<Fetcher> fetcher, |
| 215 const base::FilePath& file_path, | 216 const base::FilePath& file_path, |
| 216 bool path_exists); | 217 bool path_exists); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 ScopedVector<NativeRunner> native_runners_; | 256 ScopedVector<NativeRunner> native_runners_; |
| 256 bool initialized_authentication_interceptor_; | 257 bool initialized_authentication_interceptor_; |
| 257 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 258 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
| 258 | 259 |
| 259 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 260 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
| 260 }; | 261 }; |
| 261 | 262 |
| 262 } // namespace shell | 263 } // namespace shell |
| 263 | 264 |
| 264 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 265 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
| OLD | NEW |