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

Side by Side Diff: mojo/runner/context.cc

Issue 1354003002: Make CapabilityFilter be part of Identity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 2 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/fetcher/about_fetcher_unittest.cc ('k') | mojo/runner/native_runner_unittest.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 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/runner/context.h" 5 #include "mojo/runner/context.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (!base::StringToUint(port_str, &port) || port > 65535) { 118 if (!base::StringToUint(port_str, &port) || port > 65535) {
119 LOG(ERROR) << "Invalid value for switch " 119 LOG(ERROR) << "Invalid value for switch "
120 << devtools_service::kRemoteDebuggingPort << ": '" << port_str 120 << devtools_service::kRemoteDebuggingPort << ": '" << port_str
121 << "' is not a valid port number."; 121 << "' is not a valid port number.";
122 return; 122 return;
123 } 123 }
124 124
125 ServiceProviderPtr devtools_service_provider; 125 ServiceProviderPtr devtools_service_provider;
126 scoped_ptr<shell::ConnectToApplicationParams> params( 126 scoped_ptr<shell::ConnectToApplicationParams> params(
127 new shell::ConnectToApplicationParams); 127 new shell::ConnectToApplicationParams);
128 params->set_originator_identity(shell::Identity(GURL("mojo:shell"))); 128 params->set_source(shell::Identity(GURL("mojo:shell")));
129 params->set_originator_filter(shell::GetPermissiveCapabilityFilter()); 129 params->SetTargetURL(GURL("mojo:devtools_service"));
130 params->SetURLInfo(GURL("mojo:devtools_service"));
131 params->set_services(GetProxy(&devtools_service_provider)); 130 params->set_services(GetProxy(&devtools_service_provider));
132 params->set_filter(shell::GetPermissiveCapabilityFilter());
133 manager->ConnectToApplication(params.Pass()); 131 manager->ConnectToApplication(params.Pass());
134 132
135 devtools_service::DevToolsCoordinatorPtr devtools_coordinator; 133 devtools_service::DevToolsCoordinatorPtr devtools_coordinator;
136 devtools_service_provider->ConnectToService( 134 devtools_service_provider->ConnectToService(
137 devtools_service::DevToolsCoordinator::Name_, 135 devtools_service::DevToolsCoordinator::Name_,
138 GetProxy(&devtools_coordinator).PassMessagePipe()); 136 GetProxy(&devtools_coordinator).PassMessagePipe());
139 devtools_coordinator->Initialize(static_cast<uint16_t>(port)); 137 devtools_coordinator->Initialize(static_cast<uint16_t>(port));
140 } 138 }
141 139
142 class TracingServiceProvider : public ServiceProvider { 140 class TracingServiceProvider : public ServiceProvider {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (command_line.HasSwitch(switches::kEnableMultiprocess)) 198 if (command_line.HasSwitch(switches::kEnableMultiprocess))
201 runner_factory.reset(new OutOfProcessNativeRunnerFactory(this)); 199 runner_factory.reset(new OutOfProcessNativeRunnerFactory(this));
202 else 200 else
203 runner_factory.reset(new InProcessNativeRunnerFactory(this)); 201 runner_factory.reset(new InProcessNativeRunnerFactory(this));
204 application_manager_->set_blocking_pool(task_runners_->blocking_pool()); 202 application_manager_->set_blocking_pool(task_runners_->blocking_pool());
205 application_manager_->set_native_runner_factory(runner_factory.Pass()); 203 application_manager_->set_native_runner_factory(runner_factory.Pass());
206 204
207 ServiceProviderPtr service_provider_ptr; 205 ServiceProviderPtr service_provider_ptr;
208 ServiceProviderPtr tracing_service_provider_ptr; 206 ServiceProviderPtr tracing_service_provider_ptr;
209 new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr)); 207 new TracingServiceProvider(GetProxy(&tracing_service_provider_ptr));
210 mojo::URLRequestPtr request(mojo::URLRequest::New());
211 request->url = mojo::String::From("mojo:tracing");
212 208
213 scoped_ptr<shell::ConnectToApplicationParams> params( 209 scoped_ptr<shell::ConnectToApplicationParams> params(
214 new shell::ConnectToApplicationParams); 210 new shell::ConnectToApplicationParams);
215 params->SetURLInfo(request.Pass()); 211 params->SetTargetURL(GURL("mojo:tracing"));
216 params->set_services(GetProxy(&service_provider_ptr)); 212 params->set_services(GetProxy(&service_provider_ptr));
217 params->set_exposed_services(tracing_service_provider_ptr.Pass()); 213 params->set_exposed_services(tracing_service_provider_ptr.Pass());
218 params->set_filter(shell::GetPermissiveCapabilityFilter());
219 application_manager_->ConnectToApplication(params.Pass()); 214 application_manager_->ConnectToApplication(params.Pass());
220 215
221 // Record the shell startup metrics used for performance testing. 216 // Record the shell startup metrics used for performance testing.
222 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 217 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
223 tracing::kEnableStatsCollectionBindings)) { 218 tracing::kEnableStatsCollectionBindings)) {
224 tracing::StartupPerformanceDataCollectorPtr collector; 219 tracing::StartupPerformanceDataCollectorPtr collector;
225 service_provider_ptr->ConnectToService( 220 service_provider_ptr->ConnectToService(
226 tracing::StartupPerformanceDataCollector::Name_, 221 tracing::StartupPerformanceDataCollector::Name_,
227 GetProxy(&collector).PassMessagePipe()); 222 GetProxy(&collector).PassMessagePipe());
228 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX) 223 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_LINUX)
(...skipping 28 matching lines...) Expand all
257 task_runners_->shell_runner()); 252 task_runners_->shell_runner());
258 base::MessageLoop::current()->Quit(); 253 base::MessageLoop::current()->Quit();
259 } 254 }
260 255
261 void Context::Run(const GURL& url) { 256 void Context::Run(const GURL& url) {
262 DCHECK(app_complete_callback_.is_null()); 257 DCHECK(app_complete_callback_.is_null());
263 ServiceProviderPtr services; 258 ServiceProviderPtr services;
264 ServiceProviderPtr exposed_services; 259 ServiceProviderPtr exposed_services;
265 260
266 app_urls_.insert(url); 261 app_urls_.insert(url);
267 mojo::URLRequestPtr request(mojo::URLRequest::New());
268 request->url = mojo::String::From(url.spec());
269 262
270 scoped_ptr<shell::ConnectToApplicationParams> params( 263 scoped_ptr<shell::ConnectToApplicationParams> params(
271 new shell::ConnectToApplicationParams); 264 new shell::ConnectToApplicationParams);
272 params->SetURLInfo(request.Pass()); 265 params->SetTarget(shell::Identity(url, std::string(),
266 shell::GetPermissiveCapabilityFilter()));
273 params->set_services(GetProxy(&services)); 267 params->set_services(GetProxy(&services));
274 params->set_exposed_services(exposed_services.Pass()); 268 params->set_exposed_services(exposed_services.Pass());
275 params->set_filter(shell::GetPermissiveCapabilityFilter());
276 params->set_on_application_end( 269 params->set_on_application_end(
277 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url)); 270 base::Bind(&Context::OnApplicationEnd, base::Unretained(this), url));
278 application_manager_->ConnectToApplication(params.Pass()); 271 application_manager_->ConnectToApplication(params.Pass());
279 } 272 }
280 273
281 void Context::RunCommandLineApplication(const base::Closure& callback) { 274 void Context::RunCommandLineApplication(const base::Closure& callback) {
282 DCHECK(app_urls_.empty()); 275 DCHECK(app_urls_.empty());
283 DCHECK(app_complete_callback_.is_null()); 276 DCHECK(app_complete_callback_.is_null());
284 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 277 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
285 base::CommandLine::StringVector args = command_line->GetArgs(); 278 base::CommandLine::StringVector args = command_line->GetArgs();
(...skipping 17 matching lines...) Expand all
303 base::MessageLoop::current()->Quit(); 296 base::MessageLoop::current()->Quit();
304 } else { 297 } else {
305 app_complete_callback_.Run(); 298 app_complete_callback_.Run();
306 } 299 }
307 } 300 }
308 } 301 }
309 } 302 }
310 303
311 } // namespace runner 304 } // namespace runner
312 } // namespace mojo 305 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/fetcher/about_fetcher_unittest.cc ('k') | mojo/runner/native_runner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698