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

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

Issue 522443003: Accept inbound connections on unix domain socket (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bug407782
Patch Set: Fix clang style complaints Created 6 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
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/context.h" 5 #include "mojo/shell/context.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h"
10 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
13 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
15 #include "gpu/command_buffer/service/mailbox_manager.h" 16 #include "gpu/command_buffer/service/mailbox_manager.h"
16 #include "mojo/application_manager/application_loader.h" 17 #include "mojo/application_manager/application_loader.h"
17 #include "mojo/application_manager/application_manager.h" 18 #include "mojo/application_manager/application_manager.h"
18 #include "mojo/application_manager/background_shell_application_loader.h" 19 #include "mojo/application_manager/background_shell_application_loader.h"
19 #include "mojo/embedder/embedder.h" 20 #include "mojo/embedder/embedder.h"
20 #include "mojo/embedder/simple_platform_support.h" 21 #include "mojo/embedder/simple_platform_support.h"
21 #include "mojo/public/cpp/application/application_connection.h" 22 #include "mojo/public/cpp/application/application_connection.h"
22 #include "mojo/public/cpp/application/application_delegate.h" 23 #include "mojo/public/cpp/application/application_delegate.h"
23 #include "mojo/public/cpp/application/application_impl.h" 24 #include "mojo/public/cpp/application/application_impl.h"
24 #include "mojo/shell/dynamic_application_loader.h" 25 #include "mojo/shell/dynamic_application_loader.h"
26 #include "mojo/shell/external_application_listener.h"
25 #include "mojo/shell/in_process_dynamic_service_runner.h" 27 #include "mojo/shell/in_process_dynamic_service_runner.h"
26 #include "mojo/shell/out_of_process_dynamic_service_runner.h" 28 #include "mojo/shell/out_of_process_dynamic_service_runner.h"
27 #include "mojo/shell/switches.h" 29 #include "mojo/shell/switches.h"
28 #include "mojo/shell/ui_application_loader_android.h" 30 #include "mojo/shell/ui_application_loader_android.h"
29 #include "mojo/spy/spy.h" 31 #include "mojo/spy/spy.h"
30 32
31 #if defined(OS_LINUX) 33 #if defined(OS_LINUX)
32 #include "mojo/shell/dbus_application_loader_linux.h" 34 #include "mojo/shell/dbus_application_loader_linux.h"
33 #endif // defined(OS_LINUX) 35 #endif // defined(OS_LINUX)
34 36
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 171 }
170 172
171 void Context::Init() { 173 void Context::Init() {
172 application_manager_.set_delegate(this); 174 application_manager_.set_delegate(this);
173 setup.Get(); 175 setup.Get();
174 task_runners_.reset( 176 task_runners_.reset(
175 new TaskRunners(base::MessageLoop::current()->message_loop_proxy())); 177 new TaskRunners(base::MessageLoop::current()->message_loop_proxy()));
176 178
177 for (size_t i = 0; i < arraysize(kLocalMojoURLs); ++i) 179 for (size_t i = 0; i < arraysize(kLocalMojoURLs); ++i)
178 mojo_url_resolver_.AddLocalFileMapping(GURL(kLocalMojoURLs[i])); 180 mojo_url_resolver_.AddLocalFileMapping(GURL(kLocalMojoURLs[i]));
181 listener_.reset(new ExternalApplicationListener(task_runners_->shell_runner(),
182 task_runners_->io_runner()));
183 listener_->ListenInBackground(
184 base::FilePath(ExternalApplicationListener::kDefaultListenSocketPath),
185 base::Bind(&ApplicationManager::RegisterExternalApplication,
186 base::Unretained(&application_manager_)));
179 187
180 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 188 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
181 scoped_ptr<DynamicServiceRunnerFactory> runner_factory; 189 scoped_ptr<DynamicServiceRunnerFactory> runner_factory;
182 if (command_line->HasSwitch(switches::kEnableMultiprocess)) 190 if (command_line->HasSwitch(switches::kEnableMultiprocess))
183 runner_factory.reset(new OutOfProcessDynamicServiceRunnerFactory()); 191 runner_factory.reset(new OutOfProcessDynamicServiceRunnerFactory());
184 else 192 else
185 runner_factory.reset(new InProcessDynamicServiceRunnerFactory()); 193 runner_factory.reset(new InProcessDynamicServiceRunnerFactory());
186 194
187 DynamicApplicationLoader* dynamic_application_loader = 195 DynamicApplicationLoader* dynamic_application_loader =
188 new DynamicApplicationLoader(this, runner_factory.Pass()); 196 new DynamicApplicationLoader(this, runner_factory.Pass());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 ScopedMessagePipeHandle Context::ConnectToServiceByName( 255 ScopedMessagePipeHandle Context::ConnectToServiceByName(
248 const GURL& application_url, 256 const GURL& application_url,
249 const std::string& service_name) { 257 const std::string& service_name) {
250 app_urls_.insert(application_url); 258 app_urls_.insert(application_url);
251 return application_manager_.ConnectToServiceByName( 259 return application_manager_.ConnectToServiceByName(
252 application_url, service_name).Pass(); 260 application_url, service_name).Pass();
253 } 261 }
254 262
255 } // namespace shell 263 } // namespace shell
256 } // namespace mojo 264 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698