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 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
11 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
14 #include "mojo/application_manager/application_loader.h" | 15 #include "mojo/application_manager/application_loader.h" |
15 #include "mojo/application_manager/application_manager_export.h" | 16 #include "mojo/application_manager/application_manager_export.h" |
16 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 17 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
18 | 19 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 102 |
102 // Allows to interpose a debugger to service connections. | 103 // Allows to interpose a debugger to service connections. |
103 void SetInterceptor(Interceptor* interceptor); | 104 void SetInterceptor(Interceptor* interceptor); |
104 | 105 |
105 // Destroys all Shell-ends of connections established with Applications. | 106 // Destroys all Shell-ends of connections established with Applications. |
106 // Applications connected by this ApplicationManager will observe pipe errors | 107 // Applications connected by this ApplicationManager will observe pipe errors |
107 // and have a chance to shutdown. | 108 // and have a chance to shutdown. |
108 void TerminateShellConnections(); | 109 void TerminateShellConnections(); |
109 | 110 |
110 private: | 111 private: |
111 struct ContentHandlerConnection; | 112 class ContentHandlerConnection; |
112 class LoadCallbacksImpl; | 113 class LoadCallbacksImpl; |
113 class ShellImpl; | 114 class ShellImpl; |
114 | 115 |
115 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; | 116 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; |
116 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; | 117 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; |
117 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; | 118 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; |
118 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; | 119 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; |
119 typedef std::map<GURL, std::vector<std::string> > URLToArgsMap; | 120 typedef std::map<GURL, std::vector<std::string> > URLToArgsMap; |
120 | 121 |
121 void ConnectToClient(ShellImpl* shell_impl, | 122 void ConnectToClient(ShellImpl* shell_impl, |
(...skipping 12 matching lines...) Expand all Loading... |
134 URLResponsePtr url_response, | 135 URLResponsePtr url_response, |
135 ServiceProviderPtr service_provider); | 136 ServiceProviderPtr service_provider); |
136 | 137 |
137 // Returns the Loader to use for a url (using default if not overridden.) | 138 // Returns the Loader to use for a url (using default if not overridden.) |
138 // The preference is to use a loader that's been specified for an url first, | 139 // The preference is to use a loader that's been specified for an url first, |
139 // then one that's been specified for a scheme, then the default. | 140 // then one that's been specified for a scheme, then the default. |
140 ApplicationLoader* GetLoaderForURL(const GURL& url); | 141 ApplicationLoader* GetLoaderForURL(const GURL& url); |
141 | 142 |
142 // Removes a ShellImpl when it encounters an error. | 143 // Removes a ShellImpl when it encounters an error. |
143 void OnShellImplError(ShellImpl* shell_impl); | 144 void OnShellImplError(ShellImpl* shell_impl); |
| 145 // |
| 146 // Removes a ContentHandler when it encounters an error. |
| 147 void OnContentHandlerError(ContentHandlerConnection* content_handler); |
| 148 |
| 149 // Returns the arguments for the given url. |
| 150 Array<String> GetArgsForURL(const GURL& url); |
144 | 151 |
145 Delegate* delegate_; | 152 Delegate* delegate_; |
146 // Loader management. | 153 // Loader management. |
147 URLToLoaderMap url_to_loader_; | 154 URLToLoaderMap url_to_loader_; |
148 SchemeToLoaderMap scheme_to_loader_; | 155 SchemeToLoaderMap scheme_to_loader_; |
149 scoped_ptr<ApplicationLoader> default_loader_; | 156 scoped_ptr<ApplicationLoader> default_loader_; |
150 Interceptor* interceptor_; | 157 Interceptor* interceptor_; |
151 | 158 |
152 URLToShellImplMap url_to_shell_impl_; | 159 URLToShellImplMap url_to_shell_impl_; |
153 URLToContentHandlerMap url_to_content_handler_; | 160 URLToContentHandlerMap url_to_content_handler_; |
154 URLToArgsMap url_to_args_; | 161 URLToArgsMap url_to_args_; |
| 162 std::set<ShellImpl*> content_shell_impls_; |
155 | 163 |
156 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 164 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
157 | 165 |
158 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 166 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
159 }; | 167 }; |
160 | 168 |
161 } // namespace mojo | 169 } // namespace mojo |
162 | 170 |
163 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 171 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
OLD | NEW |