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 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // Sets the default Loader to be used if not overridden by SetLoaderForURL() | 85 // Sets the default Loader to be used if not overridden by SetLoaderForURL() |
86 // or SetLoaderForScheme(). | 86 // or SetLoaderForScheme(). |
87 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { | 87 void set_default_loader(scoped_ptr<ApplicationLoader> loader) { |
88 default_loader_ = loader.Pass(); | 88 default_loader_ = loader.Pass(); |
89 } | 89 } |
90 // Sets a Loader to be used for a specific url. | 90 // Sets a Loader to be used for a specific url. |
91 void SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, const GURL& url); | 91 void SetLoaderForURL(scoped_ptr<ApplicationLoader> loader, const GURL& url); |
92 // Sets a Loader to be used for a specific url scheme. | 92 // Sets a Loader to be used for a specific url scheme. |
93 void SetLoaderForScheme(scoped_ptr<ApplicationLoader> loader, | 93 void SetLoaderForScheme(scoped_ptr<ApplicationLoader> loader, |
94 const std::string& scheme); | 94 const std::string& scheme); |
| 95 // These strings will be passed to the Initialize() method when an |
| 96 // Application is instantiated. |
| 97 void SetArgsForURL(const std::vector<std::string>& args, const GURL& url); |
| 98 |
95 // Allows to interpose a debugger to service connections. | 99 // Allows to interpose a debugger to service connections. |
96 void SetInterceptor(Interceptor* interceptor); | 100 void SetInterceptor(Interceptor* interceptor); |
97 | 101 |
98 // Destroys all Shell-ends of connections established with Applications. | 102 // Destroys all Shell-ends of connections established with Applications. |
99 // Applications connected by this ApplicationManager will observe pipe errors | 103 // Applications connected by this ApplicationManager will observe pipe errors |
100 // and have a chance to shutdown. | 104 // and have a chance to shutdown. |
101 void TerminateShellConnections(); | 105 void TerminateShellConnections(); |
102 | 106 |
103 private: | 107 private: |
104 struct ContentHandlerConnection; | 108 struct ContentHandlerConnection; |
105 class LoadCallbacksImpl; | 109 class LoadCallbacksImpl; |
106 class ShellImpl; | 110 class ShellImpl; |
107 | 111 |
108 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; | 112 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; |
109 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; | 113 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; |
110 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; | 114 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; |
111 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; | 115 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; |
| 116 typedef std::map<GURL, std::vector<std::string> > URLToArgsMap; |
112 | 117 |
113 void ConnectToClient(ShellImpl* shell_impl, | 118 void ConnectToClient(ShellImpl* shell_impl, |
114 const GURL& url, | 119 const GURL& url, |
115 const GURL& requestor_url, | 120 const GURL& requestor_url, |
116 ServiceProviderPtr service_provider); | 121 ServiceProviderPtr service_provider); |
117 | 122 |
118 void RegisterLoadedApplication(const GURL& service_url, | 123 void RegisterLoadedApplication(const GURL& service_url, |
119 const GURL& requestor_url, | 124 const GURL& requestor_url, |
120 ServiceProviderPtr service_provider, | 125 ServiceProviderPtr service_provider, |
121 ScopedMessagePipeHandle* shell_handle); | 126 ScopedMessagePipeHandle* shell_handle); |
(...skipping 14 matching lines...) Expand all Loading... |
136 | 141 |
137 Delegate* delegate_; | 142 Delegate* delegate_; |
138 // Loader management. | 143 // Loader management. |
139 URLToLoaderMap url_to_loader_; | 144 URLToLoaderMap url_to_loader_; |
140 SchemeToLoaderMap scheme_to_loader_; | 145 SchemeToLoaderMap scheme_to_loader_; |
141 scoped_ptr<ApplicationLoader> default_loader_; | 146 scoped_ptr<ApplicationLoader> default_loader_; |
142 Interceptor* interceptor_; | 147 Interceptor* interceptor_; |
143 | 148 |
144 URLToShellImplMap url_to_shell_impl_; | 149 URLToShellImplMap url_to_shell_impl_; |
145 URLToContentHandlerMap url_to_content_handler_; | 150 URLToContentHandlerMap url_to_content_handler_; |
| 151 URLToArgsMap url_to_args_; |
146 | 152 |
147 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; | 153 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; |
148 | 154 |
149 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); | 155 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); |
150 }; | 156 }; |
151 | 157 |
152 } // namespace mojo | 158 } // namespace mojo |
153 | 159 |
154 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ | 160 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ |
OLD | NEW |