| 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_MANAGER_APPLICATION_MANAGER_H_ | 5 #ifndef MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
| 6 #define MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 6 #define MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 static bool HasCreatedInstance(); | 41 static bool HasCreatedInstance(); |
| 42 // Returns true if there is a ShellImpl for this URL. | 42 // Returns true if there is a ShellImpl for this URL. |
| 43 bool HasFactoryForURL(const GURL& url) const; | 43 bool HasFactoryForURL(const GURL& url) const; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 ApplicationManager* manager_; | 46 ApplicationManager* manager_; |
| 47 | 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(TestAPI); | 48 DISALLOW_COPY_AND_ASSIGN(TestAPI); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 ApplicationManager(Delegate* delegate); | 51 explicit ApplicationManager(Delegate* delegate); |
| 52 ~ApplicationManager(); | 52 ~ApplicationManager(); |
| 53 | 53 |
| 54 // Loads a service if necessary and establishes a new client connection. | 54 // Loads a service if necessary and establishes a new client connection. |
| 55 void ConnectToApplication(const GURL& application_url, | 55 void ConnectToApplication(const GURL& application_url, |
| 56 const GURL& requestor_url, | 56 const GURL& requestor_url, |
| 57 ServiceProviderPtr service_provider); | 57 InterfaceRequest<ServiceProvider> services, |
| 58 ServiceProviderPtr exposed_services); |
| 58 | 59 |
| 59 template <typename Interface> | 60 template <typename Interface> |
| 60 inline void ConnectToService(const GURL& application_url, | 61 inline void ConnectToService(const GURL& application_url, |
| 61 InterfacePtr<Interface>* ptr) { | 62 InterfacePtr<Interface>* ptr) { |
| 62 ScopedMessagePipeHandle service_handle = | 63 ScopedMessagePipeHandle service_handle = |
| 63 ConnectToServiceByName(application_url, Interface::Name_); | 64 ConnectToServiceByName(application_url, Interface::Name_); |
| 64 ptr->Bind(service_handle.Pass()); | 65 ptr->Bind(service_handle.Pass()); |
| 65 } | 66 } |
| 66 | 67 |
| 67 ScopedMessagePipeHandle ConnectToServiceByName( | 68 ScopedMessagePipeHandle ConnectToServiceByName( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 104 |
| 104 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; | 105 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; |
| 105 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; | 106 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; |
| 106 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; | 107 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; |
| 107 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; | 108 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; |
| 108 typedef std::map<GURL, std::vector<std::string> > URLToArgsMap; | 109 typedef std::map<GURL, std::vector<std::string> > URLToArgsMap; |
| 109 | 110 |
| 110 void ConnectToApplicationImpl(const GURL& requested_url, | 111 void ConnectToApplicationImpl(const GURL& requested_url, |
| 111 const GURL& resolved_url, | 112 const GURL& resolved_url, |
| 112 const GURL& requestor_url, | 113 const GURL& requestor_url, |
| 113 ServiceProviderPtr service_provider, | 114 InterfaceRequest<ServiceProvider> services, |
| 115 ServiceProviderPtr exposed_services, |
| 114 ApplicationLoader* loader); | 116 ApplicationLoader* loader); |
| 115 | 117 |
| 116 void ConnectToClient(ShellImpl* shell_impl, | 118 void ConnectToClient(ShellImpl* shell_impl, |
| 117 const GURL& url, | 119 const GURL& url, |
| 118 const GURL& requestor_url, | 120 const GURL& requestor_url, |
| 119 ServiceProviderPtr service_provider); | 121 InterfaceRequest<ServiceProvider> services, |
| 122 ServiceProviderPtr exposed_services); |
| 120 | 123 |
| 121 void LoadWithContentHandler(const GURL& content_handler_url, | 124 void LoadWithContentHandler(const GURL& content_handler_url, |
| 122 ScopedMessagePipeHandle shell_handle, | 125 ScopedMessagePipeHandle shell_handle, |
| 123 URLResponsePtr url_response); | 126 URLResponsePtr url_response); |
| 124 | 127 |
| 125 // Return the appropriate loader for |url|. This can return NULL if there is | 128 // Return the appropriate loader for |url|. This can return NULL if there is |
| 126 // no default loader configured. | 129 // no default loader configured. |
| 127 ApplicationLoader* GetLoaderForURL(const GURL& url, | 130 ApplicationLoader* GetLoaderForURL(const GURL& url, |
| 128 IncludeDefaultLoader fallback); | 131 IncludeDefaultLoader fallback); |
| 129 | 132 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 144 URLToArgsMap url_to_args_; | 147 URLToArgsMap url_to_args_; |
| 145 | 148 |
| 146 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 149 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
| 147 | 150 |
| 148 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 151 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
| 149 }; | 152 }; |
| 150 | 153 |
| 151 } // namespace mojo | 154 } // namespace mojo |
| 152 | 155 |
| 153 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 156 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
| OLD | NEW |