Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: shell/application_manager/application_manager.h

Issue 983113002: ApplicationManager: Use callback to get notified on application shutdown. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase after parameters fix Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | shell/application_manager/application_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 namespace shell { 29 namespace shell {
30 30
31 class Fetcher; 31 class Fetcher;
32 class ShellImpl; 32 class ShellImpl;
33 33
34 class ApplicationManager { 34 class ApplicationManager {
35 public: 35 public:
36 class Delegate { 36 class Delegate {
37 public: 37 public:
38 virtual ~Delegate(); 38 virtual ~Delegate();
39 // Send when the Application holding the handle on the other end of the
40 // Shell pipe goes away.
41 virtual void OnApplicationError(const GURL& url);
42 virtual GURL ResolveURL(const GURL& url); 39 virtual GURL ResolveURL(const GURL& url);
43 virtual GURL ResolveMappings(const GURL& url); 40 virtual GURL ResolveMappings(const GURL& url);
44 }; 41 };
45 42
46 // API for testing. 43 // API for testing.
47 class TestAPI { 44 class TestAPI {
48 public: 45 public:
49 explicit TestAPI(ApplicationManager* manager); 46 explicit TestAPI(ApplicationManager* manager);
50 ~TestAPI(); 47 ~TestAPI();
51 48
52 // Returns true if the shared instance has been created. 49 // Returns true if the shared instance has been created.
53 static bool HasCreatedInstance(); 50 static bool HasCreatedInstance();
54 // Returns true if there is a ShellImpl for this URL. 51 // Returns true if there is a ShellImpl for this URL.
55 bool HasFactoryForURL(const GURL& url) const; 52 bool HasFactoryForURL(const GURL& url) const;
56 53
57 private: 54 private:
58 ApplicationManager* manager_; 55 ApplicationManager* manager_;
59 56
60 DISALLOW_COPY_AND_ASSIGN(TestAPI); 57 DISALLOW_COPY_AND_ASSIGN(TestAPI);
61 }; 58 };
62 59
63 explicit ApplicationManager(Delegate* delegate); 60 explicit ApplicationManager(Delegate* delegate);
64 ~ApplicationManager(); 61 ~ApplicationManager();
65 62
66 // Loads a service if necessary and establishes a new client connection. 63 // Loads a service if necessary and establishes a new client connection.
67 void ConnectToApplication(const GURL& application_url, 64 void ConnectToApplication(const GURL& application_url,
68 const GURL& requestor_url, 65 const GURL& requestor_url,
69 InterfaceRequest<ServiceProvider> services, 66 InterfaceRequest<ServiceProvider> services,
70 ServiceProviderPtr exposed_services); 67 ServiceProviderPtr exposed_services,
68 const base::Closure& on_application_end);
71 69
72 template <typename Interface> 70 template <typename Interface>
73 inline void ConnectToService(const GURL& application_url, 71 inline void ConnectToService(const GURL& application_url,
74 InterfacePtr<Interface>* ptr) { 72 InterfacePtr<Interface>* ptr) {
75 ScopedMessagePipeHandle service_handle = 73 ScopedMessagePipeHandle service_handle =
76 ConnectToServiceByName(application_url, Interface::Name_); 74 ConnectToServiceByName(application_url, Interface::Name_);
77 ptr->Bind(service_handle.Pass()); 75 ptr->Bind(service_handle.Pass());
78 } 76 }
79 77
80 ScopedMessagePipeHandle ConnectToServiceByName( 78 ScopedMessagePipeHandle ConnectToServiceByName(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; 136 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap;
139 typedef std::map<GURL, std::vector<std::string>> URLToArgsMap; 137 typedef std::map<GURL, std::vector<std::string>> URLToArgsMap;
140 typedef std::map<std::string, GURL> MimeTypeToURLMap; 138 typedef std::map<std::string, GURL> MimeTypeToURLMap;
141 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap; 139 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap;
142 140
143 void ConnectToApplicationWithParameters( 141 void ConnectToApplicationWithParameters(
144 const GURL& application_url, 142 const GURL& application_url,
145 const GURL& requestor_url, 143 const GURL& requestor_url,
146 InterfaceRequest<ServiceProvider> services, 144 InterfaceRequest<ServiceProvider> services,
147 ServiceProviderPtr exposed_services, 145 ServiceProviderPtr exposed_services,
146 const base::Closure& on_application_end,
148 const std::vector<std::string>& parameters); 147 const std::vector<std::string>& parameters);
149 148
150 bool ConnectToRunningApplication(const GURL& resolved_url, 149 bool ConnectToRunningApplication(const GURL& resolved_url,
151 const GURL& requestor_url, 150 const GURL& requestor_url,
152 InterfaceRequest<ServiceProvider>* services, 151 InterfaceRequest<ServiceProvider>* services,
153 ServiceProviderPtr* exposed_services); 152 ServiceProviderPtr* exposed_services);
154 153
155 bool ConnectToApplicationWithLoader( 154 bool ConnectToApplicationWithLoader(
156 const GURL& requested_url,
157 const GURL& resolved_url, 155 const GURL& resolved_url,
158 const GURL& requestor_url, 156 const GURL& requestor_url,
159 InterfaceRequest<ServiceProvider>* services, 157 InterfaceRequest<ServiceProvider>* services,
160 ServiceProviderPtr* exposed_services, 158 ServiceProviderPtr* exposed_services,
159 const base::Closure& on_application_end,
161 const std::vector<std::string>& parameters, 160 const std::vector<std::string>& parameters,
162 ApplicationLoader* loader); 161 ApplicationLoader* loader);
163 162
164 InterfaceRequest<Application> RegisterShell( 163 InterfaceRequest<Application> RegisterShell(
165 // The original URL requested by client, before any resolution or
166 // redirects.
167 // This is mostly useless and should be removed.
168 const GURL& original_url,
169 // The URL after resolution and redirects, including the querystring. 164 // The URL after resolution and redirects, including the querystring.
170 const GURL& resolved_url, 165 const GURL& resolved_url,
171 const GURL& requestor_url, 166 const GURL& requestor_url,
172 InterfaceRequest<ServiceProvider> services, 167 InterfaceRequest<ServiceProvider> services,
173 ServiceProviderPtr exposed_services, 168 ServiceProviderPtr exposed_services,
169 const base::Closure& on_application_end,
174 const std::vector<std::string>& parameters); 170 const std::vector<std::string>& parameters);
175 171
176 ShellImpl* GetShellImpl(const GURL& url); 172 ShellImpl* GetShellImpl(const GURL& url);
177 173
178 void ConnectToClient(ShellImpl* shell_impl, 174 void ConnectToClient(ShellImpl* shell_impl,
179 const GURL& resolved_url, 175 const GURL& resolved_url,
180 const GURL& requestor_url, 176 const GURL& requestor_url,
181 InterfaceRequest<ServiceProvider> services, 177 InterfaceRequest<ServiceProvider> services,
182 ServiceProviderPtr exposed_services); 178 ServiceProviderPtr exposed_services);
183 179
184 void HandleFetchCallback(const GURL& requested_url, 180 void HandleFetchCallback(const GURL& requestor_url,
185 const GURL& requestor_url,
186 InterfaceRequest<ServiceProvider> services, 181 InterfaceRequest<ServiceProvider> services,
187 ServiceProviderPtr exposed_services, 182 ServiceProviderPtr exposed_services,
183 const base::Closure& on_application_end,
188 const std::vector<std::string>& parameters, 184 const std::vector<std::string>& parameters,
189 NativeRunner::CleanupBehavior cleanup_behavior, 185 NativeRunner::CleanupBehavior cleanup_behavior,
190 scoped_ptr<Fetcher> fetcher); 186 scoped_ptr<Fetcher> fetcher);
191 187
192 void RunNativeApplication(InterfaceRequest<Application> application_request, 188 void RunNativeApplication(InterfaceRequest<Application> application_request,
193 const NativeRunnerFactory::Options& options, 189 const NativeRunnerFactory::Options& options,
194 NativeRunner::CleanupBehavior cleanup_behavior, 190 NativeRunner::CleanupBehavior cleanup_behavior,
195 scoped_ptr<Fetcher> fetcher, 191 scoped_ptr<Fetcher> fetcher,
196 const base::FilePath& file_path, 192 const base::FilePath& file_path,
197 bool path_exists); 193 bool path_exists);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 bool disable_cache_; 229 bool disable_cache_;
234 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; 230 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_;
235 231
236 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); 232 DISALLOW_COPY_AND_ASSIGN(ApplicationManager);
237 }; 233 };
238 234
239 } // namespace shell 235 } // namespace shell
240 } // namespace mojo 236 } // namespace mojo
241 237
242 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 238 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | shell/application_manager/application_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698