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