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

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

Issue 1801963002: Change primordial pipes to ShellClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase onto catalog CL Created 4 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 | « mojo/shell/runner/host/out_of_process_native_runner.cc ('k') | mojo/shell/shell.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_SHELL_H_ 5 #ifndef MOJO_SHELL_SHELL_H_
6 #define MOJO_SHELL_SHELL_H_ 6 #define MOJO_SHELL_SHELL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 // Removes a Instance when it encounters an error. 105 // Removes a Instance when it encounters an error.
106 void OnInstanceError(Instance* instance); 106 void OnInstanceError(Instance* instance);
107 107
108 // Completes a connection between a source and target application as defined 108 // Completes a connection between a source and target application as defined
109 // by |params|, exchanging InterfaceProviders between them. If no existing 109 // by |params|, exchanging InterfaceProviders between them. If no existing
110 // instance of the target application is running, one will be loaded. 110 // instance of the target application is running, one will be loaded.
111 // 111 //
112 // If |client| is not null, there must not be an instance of the target 112 // If |client| is not null, there must not be an instance of the target
113 // application already running. The shell will create a new instance and use 113 // application already running. The shell will create a new instance and use
114 // |client| to control. 114 // |client| to control it.
115 void Connect(scoped_ptr<ConnectParams> params, mojom::ShellClientPtr client); 115 void Connect(scoped_ptr<ConnectParams> params, mojom::ShellClientPtr client);
116 116
117 // Returns a running instance matching |identity|. 117 // Returns a running instance matching |identity|.
118 Instance* GetExistingInstance(const Identity& identity) const; 118 Instance* GetExistingInstance(const Identity& identity) const;
119 // Like GetExistingInstance, but if no instance for |identity.user_id()| is 119 // Like GetExistingInstance, but if no instance for |identity.user_id()| is
120 // found, looks for kRootUserID too. 120 // found, looks for kRootUserID too.
121 Instance* GetExistingOrRootInstance(const Identity& identity) const; 121 Instance* GetExistingOrRootInstance(const Identity& identity) const;
122 122
123 void NotifyPIDAvailable(uint32_t id, base::ProcessId pid); 123 void NotifyPIDAvailable(uint32_t id, base::ProcessId pid);
124 124
125 // Attempt to complete the connection requested by |params| by connecting to 125 // Attempt to complete the connection requested by |params| by connecting to
126 // an existing instance. If there is an existing instance, |params| is taken, 126 // an existing instance. If there is an existing instance, |params| is taken,
127 // and this function returns true. 127 // and this function returns true.
128 bool ConnectToExistingInstance(scoped_ptr<ConnectParams>* params); 128 bool ConnectToExistingInstance(scoped_ptr<ConnectParams>* params);
129 129
130 Instance* CreateInstance(const Identity& target, 130 Instance* CreateInstance(const Identity& target,
131 const CapabilitySpec& spec, 131 const CapabilitySpec& spec);
132 mojom::ShellClientPtr client);
133 132
134 // Called from the instance implementing mojom::Shell. 133 // Called from the instance implementing mojom::Shell.
135 void AddInstanceListener(mojom::InstanceListenerPtr listener); 134 void AddInstanceListener(mojom::InstanceListenerPtr listener);
136 135
137 void CreateShellClient(const Identity& source, 136 void CreateShellClientWithFactory(const Identity& source,
138 const Identity& shell_client_factory, 137 const Identity& shell_client_factory,
139 const std::string& name, 138 const std::string& name,
140 mojom::ShellClientRequest request); 139 mojom::ShellClientRequest request);
141 // Returns a running ShellClientFactory for |shell_client_factory_identity|, 140 // Returns a running ShellClientFactory for |shell_client_factory_identity|.
142 // if there is not one running one is started for |source_identity|. 141 // If there is not one running one is started for |source_identity|.
143 mojom::ShellClientFactory* GetShellClientFactory( 142 mojom::ShellClientFactory* GetShellClientFactory(
144 const Identity& shell_client_factory_identity, 143 const Identity& shell_client_factory_identity,
145 const Identity& source_identity); 144 const Identity& source_identity);
146 void OnShellClientFactoryLost(const Identity& which);; 145 void OnShellClientFactoryLost(const Identity& which);
147 146
148 // Callback when remote Catalog resolves mojo:foo to mojo:bar. 147 // Callback when remote Catalog resolves mojo:foo to mojo:bar.
149 // |params| are the params passed to Connect(). 148 // |params| are the params passed to Connect().
150 // |client| if provided is a ShellClientPtr which should be used to manage the 149 // |client| if provided is a ShellClientPtr which should be used to manage the
151 // new application instance. This may be null. 150 // new application instance. This may be null.
152 // |resolved_name| is the mojo: name identifying the physical package 151 // |resolved_name| is the mojo: name identifying the physical package
153 // application. 152 // application.
154 // |file_url| is the resolved file:// URL of the physical package. 153 // |file_url| is the resolved file:// URL of the physical package.
155 // |capabilities| is the CapabilitySpecPtr the requested application should be 154 // |capabilities| is the CapabilitySpecPtr the requested application should be
156 // run with, from its manifest. 155 // run with, from its manifest.
(...skipping 17 matching lines...) Expand all
174 void CleanupRunner(NativeRunner* runner); 173 void CleanupRunner(NativeRunner* runner);
175 174
176 // Loader management. 175 // Loader management.
177 // Loaders are chosen in the order they are listed here. 176 // Loaders are chosen in the order they are listed here.
178 NameToLoaderMap name_to_loader_; 177 NameToLoaderMap name_to_loader_;
179 scoped_ptr<Loader> default_loader_; 178 scoped_ptr<Loader> default_loader_;
180 179
181 IdentityToInstanceMap identity_to_instance_; 180 IdentityToInstanceMap identity_to_instance_;
182 181
183 IdentityToShellClientFactoryMap shell_client_factories_; 182 IdentityToShellClientFactoryMap shell_client_factories_;
184 // Counter used to assign ids to content handlers. 183 // Counter used to assign ids to client factories.
185 uint32_t shell_client_factory_id_counter_; 184 uint32_t shell_client_factory_id_counter_;
186 185
187 InterfacePtrSet<mojom::InstanceListener> instance_listeners_; 186 InterfacePtrSet<mojom::InstanceListener> instance_listeners_;
188 187
189 base::Callback<void(const Identity&)> instance_quit_callback_; 188 base::Callback<void(const Identity&)> instance_quit_callback_;
190 scoped_ptr<NativeRunnerFactory> native_runner_factory_; 189 scoped_ptr<NativeRunnerFactory> native_runner_factory_;
191 std::vector<scoped_ptr<NativeRunner>> native_runners_; 190 std::vector<scoped_ptr<NativeRunner>> native_runners_;
192 scoped_ptr<ShellConnection> shell_connection_; 191 scoped_ptr<ShellConnection> shell_connection_;
193 base::WeakPtrFactory<Shell> weak_ptr_factory_; 192 base::WeakPtrFactory<Shell> weak_ptr_factory_;
194 193
195 DISALLOW_COPY_AND_ASSIGN(Shell); 194 DISALLOW_COPY_AND_ASSIGN(Shell);
196 }; 195 };
197 196
198 mojom::Connector::ConnectCallback EmptyConnectCallback(); 197 mojom::Connector::ConnectCallback EmptyConnectCallback();
199 198
200 } // namespace shell 199 } // namespace shell
201 } // namespace mojo 200 } // namespace mojo
202 201
203 #endif // MOJO_SHELL_SHELL_H_ 202 #endif // MOJO_SHELL_SHELL_H_
OLDNEW
« no previous file with comments | « mojo/shell/runner/host/out_of_process_native_runner.cc ('k') | mojo/shell/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698