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

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: 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
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 17 matching lines...) Expand all
28 namespace shell { 28 namespace shell {
29 29
30 class Fetcher; 30 class Fetcher;
31 class ShellImpl; 31 class ShellImpl;
32 32
33 class ApplicationManager { 33 class ApplicationManager {
34 public: 34 public:
35 class Delegate { 35 class Delegate {
36 public: 36 public:
37 virtual ~Delegate(); 37 virtual ~Delegate();
38 // Send when the Application holding the handle on the other end of the
39 // Shell pipe goes away.
40 virtual void OnApplicationError(const GURL& url);
41 virtual GURL ResolveURL(const GURL& url); 38 virtual GURL ResolveURL(const GURL& url);
42 virtual GURL ResolveMappings(const GURL& url); 39 virtual GURL ResolveMappings(const GURL& url);
43 }; 40 };
44 41
45 // API for testing. 42 // API for testing.
46 class TestAPI { 43 class TestAPI {
47 public: 44 public:
48 explicit TestAPI(ApplicationManager* manager); 45 explicit TestAPI(ApplicationManager* manager);
49 ~TestAPI(); 46 ~TestAPI();
50 47
51 // Returns true if the shared instance has been created. 48 // Returns true if the shared instance has been created.
52 static bool HasCreatedInstance(); 49 static bool HasCreatedInstance();
53 // Returns true if there is a ShellImpl for this URL. 50 // Returns true if there is a ShellImpl for this URL.
54 bool HasFactoryForURL(const GURL& url) const; 51 bool HasFactoryForURL(const GURL& url) const;
55 52
56 private: 53 private:
57 ApplicationManager* manager_; 54 ApplicationManager* manager_;
58 55
59 DISALLOW_COPY_AND_ASSIGN(TestAPI); 56 DISALLOW_COPY_AND_ASSIGN(TestAPI);
60 }; 57 };
61 58
62 explicit ApplicationManager(Delegate* delegate); 59 explicit ApplicationManager(Delegate* delegate);
63 ~ApplicationManager(); 60 ~ApplicationManager();
64 61
65 // Loads a service if necessary and establishes a new client connection. 62 // Loads a service if necessary and establishes a new client connection.
66 void ConnectToApplication(const GURL& application_url, 63 void ConnectToApplication(const GURL& application_url,
67 const GURL& requestor_url, 64 const GURL& requestor_url,
68 InterfaceRequest<ServiceProvider> services, 65 InterfaceRequest<ServiceProvider> services,
69 ServiceProviderPtr exposed_services); 66 ServiceProviderPtr exposed_services,
67 const base::Closure& on_application_end);
70 68
71 template <typename Interface> 69 template <typename Interface>
72 inline void ConnectToService(const GURL& application_url, 70 inline void ConnectToService(const GURL& application_url,
73 InterfacePtr<Interface>* ptr) { 71 InterfacePtr<Interface>* ptr) {
74 ScopedMessagePipeHandle service_handle = 72 ScopedMessagePipeHandle service_handle =
75 ConnectToServiceByName(application_url, Interface::Name_); 73 ConnectToServiceByName(application_url, Interface::Name_);
76 ptr->Bind(service_handle.Pass()); 74 ptr->Bind(service_handle.Pass());
77 } 75 }
78 76
79 ScopedMessagePipeHandle ConnectToServiceByName( 77 ScopedMessagePipeHandle ConnectToServiceByName(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 typedef std::map<GURL, std::vector<std::string>> URLToArgsMap; 135 typedef std::map<GURL, std::vector<std::string>> URLToArgsMap;
138 typedef std::map<std::string, GURL> MimeTypeToURLMap; 136 typedef std::map<std::string, GURL> MimeTypeToURLMap;
139 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap; 137 typedef std::map<GURL, NativeRunnerFactory::Options> URLToNativeOptionsMap;
140 138
141 bool ConnectToRunningApplication(const GURL& resolved_url, 139 bool ConnectToRunningApplication(const GURL& resolved_url,
142 const GURL& requestor_url, 140 const GURL& requestor_url,
143 InterfaceRequest<ServiceProvider>* services, 141 InterfaceRequest<ServiceProvider>* services,
144 ServiceProviderPtr* exposed_services); 142 ServiceProviderPtr* exposed_services);
145 143
146 bool ConnectToApplicationWithLoader( 144 bool ConnectToApplicationWithLoader(
147 const GURL& requested_url,
148 const GURL& resolved_url, 145 const GURL& resolved_url,
149 const GURL& requestor_url, 146 const GURL& requestor_url,
150 InterfaceRequest<ServiceProvider>* services, 147 InterfaceRequest<ServiceProvider>* services,
151 ServiceProviderPtr* exposed_services, 148 ServiceProviderPtr* exposed_services,
149 const base::Closure& on_application_end,
152 ApplicationLoader* loader); 150 ApplicationLoader* loader);
153 151
154 InterfaceRequest<Application> RegisterShell( 152 InterfaceRequest<Application> RegisterShell(
155 // The original URL requested by client, before any resolution or
156 // redirects.
157 // This is mostly useless and should be removed.
158 const GURL& original_url,
159 // The URL after resolution and redirects, including the querystring. 153 // The URL after resolution and redirects, including the querystring.
160 const GURL& resolved_url, 154 const GURL& resolved_url,
161 const GURL& requestor_url, 155 const GURL& requestor_url,
162 InterfaceRequest<ServiceProvider> services, 156 InterfaceRequest<ServiceProvider> services,
163 ServiceProviderPtr exposed_services); 157 ServiceProviderPtr exposed_services,
158 const base::Closure& on_application_end);
164 159
165 ShellImpl* GetShellImpl(const GURL& url); 160 ShellImpl* GetShellImpl(const GURL& url);
166 161
167 void ConnectToClient(ShellImpl* shell_impl, 162 void ConnectToClient(ShellImpl* shell_impl,
168 const GURL& resolved_url, 163 const GURL& resolved_url,
169 const GURL& requestor_url, 164 const GURL& requestor_url,
170 InterfaceRequest<ServiceProvider> services, 165 InterfaceRequest<ServiceProvider> services,
171 ServiceProviderPtr exposed_services); 166 ServiceProviderPtr exposed_services);
172 167
173 void HandleFetchCallback(const GURL& requested_url, 168 void HandleFetchCallback(const GURL& requestor_url,
174 const GURL& requestor_url,
175 InterfaceRequest<ServiceProvider> services, 169 InterfaceRequest<ServiceProvider> services,
176 ServiceProviderPtr exposed_services, 170 ServiceProviderPtr exposed_services,
171 const base::Closure& on_application_end,
177 NativeRunner::CleanupBehavior cleanup_behavior, 172 NativeRunner::CleanupBehavior cleanup_behavior,
178 scoped_ptr<Fetcher> fetcher); 173 scoped_ptr<Fetcher> fetcher);
179 174
180 void RunNativeApplication(InterfaceRequest<Application> application_request, 175 void RunNativeApplication(InterfaceRequest<Application> application_request,
181 const NativeRunnerFactory::Options& options, 176 const NativeRunnerFactory::Options& options,
182 NativeRunner::CleanupBehavior cleanup_behavior, 177 NativeRunner::CleanupBehavior cleanup_behavior,
183 scoped_ptr<Fetcher> fetcher, 178 scoped_ptr<Fetcher> fetcher,
184 const base::FilePath& file_path, 179 const base::FilePath& file_path,
185 bool path_exists); 180 bool path_exists);
186 181
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 ScopedVector<NativeRunner> native_runners_; 217 ScopedVector<NativeRunner> native_runners_;
223 bool disable_cache_; 218 bool disable_cache_;
224 219
225 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); 220 DISALLOW_COPY_AND_ASSIGN(ApplicationManager);
226 }; 221 };
227 222
228 } // namespace shell 223 } // namespace shell
229 } // namespace mojo 224 } // namespace mojo
230 225
231 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 226 #endif // SHELL_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | shell/application_manager/application_manager.cc » ('j') | shell/application_manager/application_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698