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

Side by Side Diff: mojo/shell/standalone/context.cc

Issue 1686223002: Move InterfaceProvider into the shell::mojom namespace like the rest of the shell interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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/public/interfaces/shell_client.mojom ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "mojo/shell/standalone/context.h" 5 #include "mojo/shell/standalone/context.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 LOG(ERROR) << "Invalid value for switch " << switches::kContentHandlers 105 LOG(ERROR) << "Invalid value for switch " << switches::kContentHandlers
106 << ": '" << parts[i + 1] << "' is not a valid URL."; 106 << ": '" << parts[i + 1] << "' is not a valid URL.";
107 return; 107 return;
108 } 108 }
109 // TODO(eseidel): We should also validate that the mimetype is valid 109 // TODO(eseidel): We should also validate that the mimetype is valid
110 // net/base/mime_util.h could do this, but we don't want to depend on net. 110 // net/base/mime_util.h could do this, but we don't want to depend on net.
111 manager->RegisterContentHandler(parts[i], url); 111 manager->RegisterContentHandler(parts[i], url);
112 } 112 }
113 } 113 }
114 114
115 class TracingInterfaceProvider : public InterfaceProvider { 115 class TracingInterfaceProvider : public shell::mojom::InterfaceProvider {
116 public: 116 public:
117 TracingInterfaceProvider(Tracer* tracer, 117 TracingInterfaceProvider(Tracer* tracer,
118 InterfaceRequest<InterfaceProvider> request) 118 shell::mojom::InterfaceProviderRequest request)
119 : tracer_(tracer), binding_(this, std::move(request)) {} 119 : tracer_(tracer), binding_(this, std::move(request)) {}
120 ~TracingInterfaceProvider() override {} 120 ~TracingInterfaceProvider() override {}
121 121
122 // shell::mojom::InterfaceProvider:
122 void GetInterface(const mojo::String& interface_name, 123 void GetInterface(const mojo::String& interface_name,
123 ScopedMessagePipeHandle client_handle) override { 124 ScopedMessagePipeHandle client_handle) override {
124 if (tracer_ && interface_name == tracing::TraceProvider::Name_) { 125 if (tracer_ && interface_name == tracing::TraceProvider::Name_) {
125 tracer_->ConnectToProvider( 126 tracer_->ConnectToProvider(
126 MakeRequest<tracing::TraceProvider>(std::move(client_handle))); 127 MakeRequest<tracing::TraceProvider>(std::move(client_handle)));
127 } 128 }
128 } 129 }
129 130
130 private: 131 private:
131 Tracer* tracer_; 132 Tracer* tracer_;
132 StrongBinding<InterfaceProvider> binding_; 133 StrongBinding<shell::mojom::InterfaceProvider> binding_;
133 134
134 DISALLOW_COPY_AND_ASSIGN(TracingInterfaceProvider); 135 DISALLOW_COPY_AND_ASSIGN(TracingInterfaceProvider);
135 }; 136 };
136 137
137 } // namespace 138 } // namespace
138 139
139 Context::Context() 140 Context::Context()
140 : package_manager_(nullptr), main_entry_time_(base::Time::Now()) {} 141 : package_manager_(nullptr), main_entry_time_(base::Time::Now()) {}
141 142
142 Context::~Context() { 143 Context::~Context() {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 runner_factory.reset( 186 runner_factory.reset(
186 new InProcessNativeRunnerFactory(task_runners_->blocking_pool())); 187 new InProcessNativeRunnerFactory(task_runners_->blocking_pool()));
187 } else { 188 } else {
188 runner_factory.reset( 189 runner_factory.reset(
189 new OutOfProcessNativeRunnerFactory(task_runners_->blocking_pool())); 190 new OutOfProcessNativeRunnerFactory(task_runners_->blocking_pool()));
190 } 191 }
191 application_manager_.reset(new ApplicationManager( 192 application_manager_.reset(new ApplicationManager(
192 make_scoped_ptr(package_manager_), std::move(runner_factory), 193 make_scoped_ptr(package_manager_), std::move(runner_factory),
193 task_runners_->blocking_pool())); 194 task_runners_->blocking_pool()));
194 195
195 InterfaceProviderPtr tracing_remote_interfaces; 196 shell::mojom::InterfaceProviderPtr tracing_remote_interfaces;
196 InterfaceProviderPtr tracing_local_interfaces; 197 shell::mojom::InterfaceProviderPtr tracing_local_interfaces;
197 new TracingInterfaceProvider(&tracer_, GetProxy(&tracing_local_interfaces)); 198 new TracingInterfaceProvider(&tracer_, GetProxy(&tracing_local_interfaces));
198 199
199 scoped_ptr<ConnectToApplicationParams> params(new ConnectToApplicationParams); 200 scoped_ptr<ConnectToApplicationParams> params(new ConnectToApplicationParams);
200 params->set_source(Identity(GURL("mojo:shell"), std::string(), 201 params->set_source(Identity(GURL("mojo:shell"), std::string(),
201 GetPermissiveCapabilityFilter())); 202 GetPermissiveCapabilityFilter()));
202 params->SetTarget(Identity(GURL("mojo:tracing"), std::string(), 203 params->SetTarget(Identity(GURL("mojo:tracing"), std::string(),
203 GetPermissiveCapabilityFilter())); 204 GetPermissiveCapabilityFilter()));
204 params->set_remote_interfaces(GetProxy(&tracing_remote_interfaces)); 205 params->set_remote_interfaces(GetProxy(&tracing_remote_interfaces));
205 params->set_local_interfaces(std::move(tracing_local_interfaces)); 206 params->set_local_interfaces(std::move(tracing_local_interfaces));
206 application_manager_->ConnectToApplication(std::move(params)); 207 application_manager_->ConnectToApplication(std::move(params));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 247 }
247 248
248 void Context::OnShutdownComplete() { 249 void Context::OnShutdownComplete() {
249 DCHECK_EQ(base::MessageLoop::current()->task_runner(), 250 DCHECK_EQ(base::MessageLoop::current()->task_runner(),
250 task_runners_->shell_runner()); 251 task_runners_->shell_runner());
251 base::MessageLoop::current()->QuitWhenIdle(); 252 base::MessageLoop::current()->QuitWhenIdle();
252 } 253 }
253 254
254 void Context::Run(const GURL& url) { 255 void Context::Run(const GURL& url) {
255 DCHECK(app_complete_callback_.is_null()); 256 DCHECK(app_complete_callback_.is_null());
256 InterfaceProviderPtr remote_interfaces; 257 shell::mojom::InterfaceProviderPtr remote_interfaces;
257 InterfaceProviderPtr local_interfaces; 258 shell::mojom::InterfaceProviderPtr local_interfaces;
258 259
259 app_urls_.insert(url); 260 app_urls_.insert(url);
260 261
261 scoped_ptr<ConnectToApplicationParams> params(new ConnectToApplicationParams); 262 scoped_ptr<ConnectToApplicationParams> params(new ConnectToApplicationParams);
262 params->SetTarget( 263 params->SetTarget(
263 Identity(url, std::string(), GetPermissiveCapabilityFilter())); 264 Identity(url, std::string(), GetPermissiveCapabilityFilter()));
264 params->set_remote_interfaces(GetProxy(&remote_interfaces)); 265 params->set_remote_interfaces(GetProxy(&remote_interfaces));
265 params->set_local_interfaces(std::move(local_interfaces)); 266 params->set_local_interfaces(std::move(local_interfaces));
266 params->set_on_application_end( 267 params->set_on_application_end(
267 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url)); 268 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url));
(...skipping 25 matching lines...) Expand all
293 base::MessageLoop::current()->QuitWhenIdle(); 294 base::MessageLoop::current()->QuitWhenIdle();
294 } else { 295 } else {
295 app_complete_callback_.Run(); 296 app_complete_callback_.Run();
296 } 297 }
297 } 298 }
298 } 299 }
299 } 300 }
300 301
301 } // namespace shell 302 } // namespace shell
302 } // namespace mojo 303 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/public/interfaces/shell_client.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698