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

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

Issue 1706063002: Eliminate ShellClientFactoryConnection & just have the ApplicationManager do it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@factory
Patch Set: . Created 4 years, 10 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/shell/application_instance.cc ('k') | mojo/shell/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_SHELL_APPLICATION_MANAGER_H_ 5 #ifndef MOJO_SHELL_APPLICATION_MANAGER_H_
6 #define MOJO_SHELL_APPLICATION_MANAGER_H_ 6 #define MOJO_SHELL_APPLICATION_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "mojo/public/cpp/bindings/weak_interface_ptr_set.h" 14 #include "mojo/public/cpp/bindings/weak_interface_ptr_set.h"
15 #include "mojo/services/package_manager/public/interfaces/shell_resolver.mojom.h " 15 #include "mojo/services/package_manager/public/interfaces/shell_resolver.mojom.h "
16 #include "mojo/shell/application_loader.h" 16 #include "mojo/shell/application_loader.h"
17 #include "mojo/shell/capability_filter.h" 17 #include "mojo/shell/capability_filter.h"
18 #include "mojo/shell/connect_to_application_params.h" 18 #include "mojo/shell/connect_to_application_params.h"
19 #include "mojo/shell/identity.h" 19 #include "mojo/shell/identity.h"
20 #include "mojo/shell/native_runner.h" 20 #include "mojo/shell/native_runner.h"
21 #include "mojo/shell/public/interfaces/application_manager.mojom.h" 21 #include "mojo/shell/public/interfaces/application_manager.mojom.h"
22 #include "mojo/shell/public/interfaces/interface_provider.mojom.h" 22 #include "mojo/shell/public/interfaces/interface_provider.mojom.h"
23 #include "mojo/shell/public/interfaces/shell.mojom.h" 23 #include "mojo/shell/public/interfaces/shell.mojom.h"
24 #include "mojo/shell/public/interfaces/shell_client.mojom.h" 24 #include "mojo/shell/public/interfaces/shell_client.mojom.h"
25 #include "mojo/shell/public/interfaces/shell_client_factory.mojom.h"
25 #include "url/gurl.h" 26 #include "url/gurl.h"
26 27
27 namespace base { 28 namespace base {
28 class FilePath; 29 class FilePath;
29 class SequencedWorkerPool; 30 class SequencedWorkerPool;
30 } 31 }
31 32
32 namespace mojo { 33 namespace mojo {
33 namespace shell { 34 namespace shell {
34 35
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 mojom::CapabilityFilterPtr filter, 98 mojom::CapabilityFilterPtr filter,
98 InterfaceRequest<mojom::PIDReceiver> pid_receiver); 99 InterfaceRequest<mojom::PIDReceiver> pid_receiver);
99 void AddListener(mojom::ApplicationManagerListenerPtr listener); 100 void AddListener(mojom::ApplicationManagerListenerPtr listener);
100 101
101 void ApplicationPIDAvailable(uint32_t id, base::ProcessId pid); 102 void ApplicationPIDAvailable(uint32_t id, base::ProcessId pid);
102 103
103 private: 104 private:
104 using IdentityToInstanceMap = std::map<Identity, ApplicationInstance*>; 105 using IdentityToInstanceMap = std::map<Identity, ApplicationInstance*>;
105 using URLToLoaderMap = std::map<GURL, ApplicationLoader*>; 106 using URLToLoaderMap = std::map<GURL, ApplicationLoader*>;
106 using IdentityToShellClientFactoryMap = 107 using IdentityToShellClientFactoryMap =
107 std::map<Identity, ShellClientFactoryConnection*>; 108 std::map<Identity, mojom::ShellClientFactoryPtr>;
108 109
109 // Takes the contents of |params| only when it returns true. 110 // Takes the contents of |params| only when it returns true.
110 bool ConnectToRunningApplication( 111 bool ConnectToRunningApplication(
111 scoped_ptr<ConnectToApplicationParams>* params); 112 scoped_ptr<ConnectToApplicationParams>* params);
112 113
113 ApplicationInstance* CreateAndConnectToInstance( 114 ApplicationInstance* CreateAndConnectToInstance(
114 scoped_ptr<ConnectToApplicationParams> params, 115 scoped_ptr<ConnectToApplicationParams> params,
115 Identity* source, 116 Identity* source,
116 Identity* target, 117 Identity* target,
117 const std::string& application_name, 118 const std::string& application_name,
118 mojom::ShellClientRequest* request); 119 mojom::ShellClientRequest* request);
119 ApplicationInstance* CreateInstance( 120 ApplicationInstance* CreateInstance(
120 const Identity& target_id, 121 const Identity& target_id,
121 const mojom::Shell::ConnectToApplicationCallback& connect_callback, 122 const mojom::Shell::ConnectToApplicationCallback& connect_callback,
122 const base::Closure& on_application_end, 123 const base::Closure& on_application_end,
123 const String& application_name, 124 const String& application_name,
124 mojom::ShellClientRequest* request); 125 mojom::ShellClientRequest* request);
125 126
126 uint32_t StartShellClientFactory(const Identity& source, 127 void CreateShellClient(const Identity& source,
127 const Identity& shell_client_factory, 128 const Identity& shell_client_factory,
128 const GURL& url, 129 const GURL& url,
129 mojom::ShellClientRequest request); 130 mojom::ShellClientRequest request);
130 // Returns a running ShellClientFactory for |shell_client_factory_identity|, 131 // Returns a running ShellClientFactory for |shell_client_factory_identity|,
131 // if there is not one running one is started for |source_identity|. 132 // if there is not one running one is started for |source_identity|.
132 ShellClientFactoryConnection* GetShellClientFactory( 133 mojom::ShellClientFactory* GetShellClientFactory(
133 const Identity& shell_client_factory_identity, 134 const Identity& shell_client_factory_identity,
134 const Identity& source_identity); 135 const Identity& source_identity);
135 void OnShellClientFactoryConnectionClosed( 136 void OnShellClientFactoryLost(const Identity& which);;
136 ShellClientFactoryConnection* shell_client_factory);
137 137
138 // Callback when remote PackageManager resolves mojo:foo to mojo:bar. 138 // Callback when remote PackageManager resolves mojo:foo to mojo:bar.
139 // |params| are the params passed to Connect(). 139 // |params| are the params passed to Connect().
140 // |resolved_url| is the mojo: url identifying the physical package 140 // |resolved_url| is the mojo: url identifying the physical package
141 // application. 141 // application.
142 // |file_url| is the resolved file:// URL of the physical package. 142 // |file_url| is the resolved file:// URL of the physical package.
143 // |application_name| is the requested application's pretty name, from its 143 // |application_name| is the requested application's pretty name, from its
144 // manifest. 144 // manifest.
145 // |base_filter| is the CapabilityFilter the requested application should be 145 // |base_filter| is the CapabilityFilter the requested application should be
146 // run with, from its manifest. 146 // run with, from its manifest.
(...skipping 26 matching lines...) Expand all
173 173
174 package_manager::mojom::ShellResolverPtr shell_resolver_; 174 package_manager::mojom::ShellResolverPtr shell_resolver_;
175 175
176 // Loader management. 176 // Loader management.
177 // Loaders are chosen in the order they are listed here. 177 // Loaders are chosen in the order they are listed here.
178 URLToLoaderMap url_to_loader_; 178 URLToLoaderMap url_to_loader_;
179 scoped_ptr<ApplicationLoader> default_loader_; 179 scoped_ptr<ApplicationLoader> default_loader_;
180 180
181 IdentityToInstanceMap identity_to_instance_; 181 IdentityToInstanceMap identity_to_instance_;
182 182
183 IdentityToShellClientFactoryMap identity_to_shell_client_factory_; 183 IdentityToShellClientFactoryMap shell_client_factories_;
184 // Counter used to assign ids to content handlers. 184 // Counter used to assign ids to content handlers.
185 uint32_t shell_client_factory_id_counter_; 185 uint32_t shell_client_factory_id_counter_;
186 186
187 WeakInterfacePtrSet<mojom::ApplicationManagerListener> listeners_; 187 WeakInterfacePtrSet<mojom::ApplicationManagerListener> listeners_;
188 188
189 base::TaskRunner* task_runner_; 189 base::TaskRunner* task_runner_;
190 scoped_ptr<NativeRunnerFactory> native_runner_factory_; 190 scoped_ptr<NativeRunnerFactory> native_runner_factory_;
191 std::vector<scoped_ptr<NativeRunner>> native_runners_; 191 std::vector<scoped_ptr<NativeRunner>> native_runners_;
192 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_; 192 base::WeakPtrFactory<ApplicationManager> weak_ptr_factory_;
193 193
194 DISALLOW_COPY_AND_ASSIGN(ApplicationManager); 194 DISALLOW_COPY_AND_ASSIGN(ApplicationManager);
195 }; 195 };
196 196
197 mojom::Shell::ConnectToApplicationCallback EmptyConnectCallback(); 197 mojom::Shell::ConnectToApplicationCallback EmptyConnectCallback();
198 198
199 } // namespace shell 199 } // namespace shell
200 } // namespace mojo 200 } // namespace mojo
201 201
202 #endif // MOJO_SHELL_APPLICATION_MANAGER_H_ 202 #endif // MOJO_SHELL_APPLICATION_MANAGER_H_
OLDNEW
« no previous file with comments | « mojo/shell/application_instance.cc ('k') | mojo/shell/application_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698