OLD | NEW |
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/context.h" | 5 #include "mojo/shell/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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 new TaskRunners(base::MessageLoop::current()->message_loop_proxy())); | 178 new TaskRunners(base::MessageLoop::current()->message_loop_proxy())); |
179 | 179 |
180 for (size_t i = 0; i < arraysize(kLocalMojoURLs); ++i) | 180 for (size_t i = 0; i < arraysize(kLocalMojoURLs); ++i) |
181 mojo_url_resolver_.AddLocalFileMapping(GURL(kLocalMojoURLs[i])); | 181 mojo_url_resolver_.AddLocalFileMapping(GURL(kLocalMojoURLs[i])); |
182 | 182 |
183 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 183 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
184 | 184 |
185 if (command_line->HasSwitch(switches::kEnableExternalApplications)) { | 185 if (command_line->HasSwitch(switches::kEnableExternalApplications)) { |
186 listener_ = ExternalApplicationListener::Create( | 186 listener_ = ExternalApplicationListener::Create( |
187 task_runners_->shell_runner(), task_runners_->io_runner()); | 187 task_runners_->shell_runner(), task_runners_->io_runner()); |
| 188 |
| 189 base::FilePath socket_path = |
| 190 command_line->GetSwitchValuePath(switches::kEnableExternalApplications); |
| 191 if (socket_path.empty()) |
| 192 socket_path = ExternalApplicationListener::ConstructDefaultSocketPath(); |
| 193 |
188 listener_->ListenInBackground( | 194 listener_->ListenInBackground( |
189 ExternalApplicationListener::ConstructDefaultSocketPath(), | 195 socket_path, |
190 base::Bind(&ApplicationManager::RegisterExternalApplication, | 196 base::Bind(&ApplicationManager::RegisterExternalApplication, |
191 base::Unretained(&application_manager_))); | 197 base::Unretained(&application_manager_))); |
192 } | 198 } |
193 scoped_ptr<DynamicServiceRunnerFactory> runner_factory; | 199 scoped_ptr<DynamicServiceRunnerFactory> runner_factory; |
194 if (command_line->HasSwitch(switches::kEnableMultiprocess)) | 200 if (command_line->HasSwitch(switches::kEnableMultiprocess)) |
195 runner_factory.reset(new OutOfProcessDynamicServiceRunnerFactory()); | 201 runner_factory.reset(new OutOfProcessDynamicServiceRunnerFactory()); |
196 else | 202 else |
197 runner_factory.reset(new InProcessDynamicServiceRunnerFactory()); | 203 runner_factory.reset(new InProcessDynamicServiceRunnerFactory()); |
198 | 204 |
199 DynamicApplicationLoader* dynamic_application_loader = | 205 DynamicApplicationLoader* dynamic_application_loader = |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 ScopedMessagePipeHandle Context::ConnectToServiceByName( | 268 ScopedMessagePipeHandle Context::ConnectToServiceByName( |
263 const GURL& application_url, | 269 const GURL& application_url, |
264 const std::string& service_name) { | 270 const std::string& service_name) { |
265 app_urls_.insert(application_url); | 271 app_urls_.insert(application_url); |
266 return application_manager_.ConnectToServiceByName( | 272 return application_manager_.ConnectToServiceByName( |
267 application_url, service_name).Pass(); | 273 application_url, service_name).Pass(); |
268 } | 274 } |
269 | 275 |
270 } // namespace shell | 276 } // namespace shell |
271 } // namespace mojo | 277 } // namespace mojo |
OLD | NEW |