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

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

Issue 821123005: Move application_manager's ShellImpl to own file (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « mojo/application_manager/BUILD.gn ('k') | mojo/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 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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "mojo/application_manager/application_loader.h" 15 #include "mojo/application_manager/application_loader.h"
16 #include "mojo/application_manager/application_manager_export.h" 16 #include "mojo/application_manager/application_manager_export.h"
17 #include "mojo/application_manager/shell_impl.h"
17 #include "mojo/public/interfaces/application/service_provider.mojom.h" 18 #include "mojo/public/interfaces/application/service_provider.mojom.h"
18 #include "url/gurl.h" 19 #include "url/gurl.h"
19 20
20 namespace mojo { 21 namespace mojo {
21 22
22 class MOJO_APPLICATION_MANAGER_EXPORT ApplicationManager { 23 class MOJO_APPLICATION_MANAGER_EXPORT ApplicationManager {
23 public: 24 public:
24 class MOJO_APPLICATION_MANAGER_EXPORT Delegate { 25 class MOJO_APPLICATION_MANAGER_EXPORT Delegate {
25 public: 26 public:
26 virtual ~Delegate(); 27 virtual ~Delegate();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 const std::string& scheme); 83 const std::string& scheme);
83 // These strings will be passed to the Initialize() method when an 84 // These strings will be passed to the Initialize() method when an
84 // Application is instantiated. 85 // Application is instantiated.
85 void SetArgsForURL(const std::vector<std::string>& args, const GURL& url); 86 void SetArgsForURL(const std::vector<std::string>& args, const GURL& url);
86 87
87 // Destroys all Shell-ends of connections established with Applications. 88 // Destroys all Shell-ends of connections established with Applications.
88 // Applications connected by this ApplicationManager will observe pipe errors 89 // Applications connected by this ApplicationManager will observe pipe errors
89 // and have a chance to shutdown. 90 // and have a chance to shutdown.
90 void TerminateShellConnections(); 91 void TerminateShellConnections();
91 92
93 // Removes a ShellImpl when it encounters an error.
94 void OnShellImplError(ShellImpl* shell_impl);
95
92 private: 96 private:
93 enum IncludeDefaultLoader { 97 enum IncludeDefaultLoader {
94 INCLUDE_DEFAULT_LOADER, 98 INCLUDE_DEFAULT_LOADER,
95 DONT_INCLUDE_DEFAULT_LOADER, 99 DONT_INCLUDE_DEFAULT_LOADER,
96 }; 100 };
97 101
98 class ContentHandlerConnection; 102 class ContentHandlerConnection;
99 class ShellImpl;
100 103
101 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap; 104 typedef std::map<std::string, ApplicationLoader*> SchemeToLoaderMap;
102 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap; 105 typedef std::map<GURL, ApplicationLoader*> URLToLoaderMap;
103 typedef std::map<GURL, ShellImpl*> URLToShellImplMap; 106 typedef std::map<GURL, ShellImpl*> URLToShellImplMap;
104 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap; 107 typedef std::map<GURL, ContentHandlerConnection*> URLToContentHandlerMap;
105 typedef std::map<GURL, std::vector<std::string> > URLToArgsMap; 108 typedef std::map<GURL, std::vector<std::string> > URLToArgsMap;
106 109
107 void ConnectToApplicationImpl(const GURL& requested_url, 110 void ConnectToApplicationImpl(const GURL& requested_url,
108 const GURL& resolved_url, 111 const GURL& resolved_url,
109 const GURL& requestor_url, 112 const GURL& requestor_url,
110 ServiceProviderPtr service_provider, 113 ServiceProviderPtr service_provider,
111 ApplicationLoader* loader); 114 ApplicationLoader* loader);
112 115
113 void ConnectToClient(ShellImpl* shell_impl, 116 void ConnectToClient(ShellImpl* shell_impl,
114 const GURL& url, 117 const GURL& url,
115 const GURL& requestor_url, 118 const GURL& requestor_url,
116 ServiceProviderPtr service_provider); 119 ServiceProviderPtr service_provider);
117 120
118 void LoadWithContentHandler(const GURL& content_handler_url, 121 void LoadWithContentHandler(const GURL& content_handler_url,
119 ScopedMessagePipeHandle shell_handle, 122 ScopedMessagePipeHandle shell_handle,
120 URLResponsePtr url_response); 123 URLResponsePtr url_response);
121 124
122 // Return the appropriate loader for |url|. This can return NULL if there is 125 // Return the appropriate loader for |url|. This can return NULL if there is
123 // no default loader configured. 126 // no default loader configured.
124 ApplicationLoader* GetLoaderForURL(const GURL& url, 127 ApplicationLoader* GetLoaderForURL(const GURL& url,
125 IncludeDefaultLoader fallback); 128 IncludeDefaultLoader fallback);
126 129
127 // Removes a ShellImpl when it encounters an error.
128 void OnShellImplError(ShellImpl* shell_impl);
129 //
130 // Removes a ContentHandler when it encounters an error. 130 // Removes a ContentHandler when it encounters an error.
131 void OnContentHandlerError(ContentHandlerConnection* content_handler); 131 void OnContentHandlerError(ContentHandlerConnection* content_handler);
132 132
133 // Returns the arguments for the given url. 133 // Returns the arguments for the given url.
134 Array<String> GetArgsForURL(const GURL& url); 134 Array<String> GetArgsForURL(const GURL& url);
135 135
136 Delegate* delegate_; 136 Delegate* delegate_;
137 // Loader management. 137 // Loader management.
138 URLToLoaderMap url_to_loader_; 138 URLToLoaderMap url_to_loader_;
139 SchemeToLoaderMap scheme_to_loader_; 139 SchemeToLoaderMap scheme_to_loader_;
140 scoped_ptr<ApplicationLoader> default_loader_; 140 scoped_ptr<ApplicationLoader> default_loader_;
141 141
142 URLToShellImplMap url_to_shell_impl_; 142 URLToShellImplMap url_to_shell_impl_;
143 URLToContentHandlerMap url_to_content_handler_; 143 URLToContentHandlerMap url_to_content_handler_;
144 URLToArgsMap url_to_args_; 144 URLToArgsMap url_to_args_;
145 145
146 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; 146 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_;
147 147
148 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); 148 DISALLOW_COPY_AND_ASSIGN(ApplicationManager);
149 }; 149 };
150 150
151 } // namespace mojo 151 } // namespace mojo
152 152
153 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_ 153 #endif // MOJO_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
OLDNEW
« no previous file with comments | « mojo/application_manager/BUILD.gn ('k') | mojo/application_manager/application_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698