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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // and have a chance to shutdown. | 102 // and have a chance to shutdown. |
103 void TerminateShellConnections(); | 103 void TerminateShellConnections(); |
104 | 104 |
105 private: | 105 private: |
106 enum IncludeDefaultLoader { | 106 enum IncludeDefaultLoader { |
107 INCLUDE_DEFAULT_LOADER, | 107 INCLUDE_DEFAULT_LOADER, |
108 DONT_INCLUDE_DEFAULT_LOADER, | 108 DONT_INCLUDE_DEFAULT_LOADER, |
109 }; | 109 }; |
110 | 110 |
111 class ContentHandlerConnection; | 111 class ContentHandlerConnection; |
112 class LoadCallbacksImpl; | |
113 class ShellImpl; | 112 class ShellImpl; |
114 | 113 |
115 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; | 114 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; |
116 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; | 115 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; |
117 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; | 116 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; |
118 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; | 117 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; |
119 typedef std::map<GURL, std::vector<std::string> > URLToArgsMap; | 118 typedef std::map<GURL, std::vector<std::string> > URLToArgsMap; |
120 | 119 |
121 void ConnectToApplicationImpl(const GURL& url, | 120 void ConnectToApplicationImpl(const GURL& url, |
122 const GURL& original_url, | 121 const GURL& original_url, |
123 const GURL& requestor_url, | 122 const GURL& requestor_url, |
124 ServiceProviderPtr service_provider, | 123 ServiceProviderPtr service_provider, |
125 ApplicationLoader* loader); | 124 ApplicationLoader* loader); |
126 | 125 |
127 void ConnectToClient(ShellImpl* shell_impl, | 126 void ConnectToClient(ShellImpl* shell_impl, |
128 const GURL& url, | 127 const GURL& url, |
129 const GURL& requestor_url, | 128 const GURL& requestor_url, |
130 ServiceProviderPtr service_provider); | 129 ServiceProviderPtr service_provider); |
131 | 130 |
132 void RegisterLoadedApplication(const GURL& requested_url, | 131 void LoadWithContentHandler(const GURL& content_handler_url, |
133 const GURL& resolved_url, | 132 ScopedMessagePipeHandle shell_handle, |
134 const GURL& requestor_url, | 133 URLResponsePtr url_response); |
135 ServiceProviderPtr service_provider, | |
136 ScopedMessagePipeHandle* shell_handle); | |
137 | |
138 void LoadWithContentHandler(const GURL& requested_url, | |
139 const GURL& resolved_url, | |
140 const GURL& requestor_url, | |
141 const GURL& content_handler_url, | |
142 URLResponsePtr url_response, | |
143 ServiceProviderPtr service_provider); | |
144 | 134 |
145 // Return the appropriate loader for |url|. This can return NULL if there is | 135 // Return the appropriate loader for |url|. This can return NULL if there is |
146 // no default loader configured. | 136 // no default loader configured. |
147 ApplicationLoader* GetLoaderForURL(const GURL& url, | 137 ApplicationLoader* GetLoaderForURL(const GURL& url, |
148 IncludeDefaultLoader fallback); | 138 IncludeDefaultLoader fallback); |
149 | 139 |
150 // Removes a ShellImpl when it encounters an error. | 140 // Removes a ShellImpl when it encounters an error. |
151 void OnShellImplError(ShellImpl* shell_impl); | 141 void OnShellImplError(ShellImpl* shell_impl); |
152 // | 142 // |
153 // Removes a ContentHandler when it encounters an error. | 143 // Removes a ContentHandler when it encounters an error. |
154 void OnContentHandlerError(ContentHandlerConnection* content_handler); | 144 void OnContentHandlerError(ContentHandlerConnection* content_handler); |
155 | 145 |
156 // Returns the arguments for the given url. | 146 // Returns the arguments for the given url. |
157 Array<String> GetArgsForURL(const GURL& url); | 147 Array<String> GetArgsForURL(const GURL& url); |
158 | 148 |
159 Delegate* delegate_; | 149 Delegate* delegate_; |
160 // Loader management. | 150 // Loader management. |
161 URLToLoaderMap url_to_loader_; | 151 URLToLoaderMap url_to_loader_; |
162 SchemeToLoaderMap scheme_to_loader_; | 152 SchemeToLoaderMap scheme_to_loader_; |
163 scoped_ptr<ApplicationLoader> default_loader_; | 153 scoped_ptr<ApplicationLoader> default_loader_; |
164 Interceptor* interceptor_; | 154 Interceptor* interceptor_; |
165 | 155 |
166 URLToShellImplMap url_to_shell_impl_; | 156 URLToShellImplMap url_to_shell_impl_; |
167 URLToContentHandlerMap url_to_content_handler_; | 157 URLToContentHandlerMap url_to_content_handler_; |
168 URLToArgsMap url_to_args_; | 158 URLToArgsMap url_to_args_; |
169 std::set<ShellImpl*> content_shell_impls_; | |
170 | 159 |
171 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 160 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
172 | 161 |
173 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 162 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
174 }; | 163 }; |
175 | 164 |
176 } // namespace mojo | 165 } // namespace mojo |
177 | 166 |
178 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 167 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
OLD | NEW |