OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/app/mash/mash_runner.h" | 5 #include "chrome/app/mash/mash_runner.h" |
6 | 6 |
7 #include "ash/mus/sysui_application.h" | 7 #include "ash/mus/sysui_application.h" |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug/debugger.h" | 11 #include "base/debug/debugger.h" |
12 #include "base/i18n/icu_util.h" | 12 #include "base/i18n/icu_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/process/launch.h" | 15 #include "base/process/launch.h" |
16 #include "components/mus/mus_app.h" | 16 #include "components/mus/mus_app.h" |
17 #include "components/resource_provider/resource_provider_app.h" | 17 #include "components/resource_provider/resource_provider_app.h" |
18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
19 #include "mash/quick_launch/quick_launch_application.h" | 19 #include "mash/quick_launch/quick_launch_application.h" |
20 #include "mash/shell/shell_application_delegate.h" | 20 #include "mash/session/session.h" |
21 #include "mash/wm/window_manager_application.h" | 21 #include "mash/wm/window_manager_application.h" |
22 #include "mojo/public/cpp/bindings/binding_set.h" | 22 #include "mojo/public/cpp/bindings/binding_set.h" |
23 #include "mojo/shell/background/background_shell.h" | 23 #include "mojo/shell/background/background_shell.h" |
24 #include "mojo/shell/native_runner_delegate.h" | 24 #include "mojo/shell/native_runner_delegate.h" |
25 #include "mojo/shell/public/cpp/connector.h" | 25 #include "mojo/shell/public/cpp/connector.h" |
26 #include "mojo/shell/public/cpp/identity.h" | 26 #include "mojo/shell/public/cpp/identity.h" |
27 #include "mojo/shell/public/cpp/shell_client.h" | 27 #include "mojo/shell/public/cpp/shell_client.h" |
28 #include "mojo/shell/public/cpp/shell_connection.h" | 28 #include "mojo/shell/public/cpp/shell_connection.h" |
29 #include "mojo/shell/public/interfaces/shell_client_factory.mojom.h" | 29 #include "mojo/shell/public/interfaces/shell_client_factory.mojom.h" |
30 #include "mojo/shell/runner/common/switches.h" | 30 #include "mojo/shell/runner/common/switches.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 NOTREACHED(); | 78 NOTREACHED(); |
79 } | 79 } |
80 | 80 |
81 private: | 81 private: |
82 // TODO(sky): move this into mash. | 82 // TODO(sky): move this into mash. |
83 scoped_ptr<mojo::ShellClient> CreateShellClient(const std::string& name) { | 83 scoped_ptr<mojo::ShellClient> CreateShellClient(const std::string& name) { |
84 if (name == "mojo:ash_sysui") | 84 if (name == "mojo:ash_sysui") |
85 return make_scoped_ptr(new ash::sysui::SysUIApplication); | 85 return make_scoped_ptr(new ash::sysui::SysUIApplication); |
86 if (name == "mojo:desktop_wm") | 86 if (name == "mojo:desktop_wm") |
87 return make_scoped_ptr(new mash::wm::WindowManagerApplication); | 87 return make_scoped_ptr(new mash::wm::WindowManagerApplication); |
88 if (name == "mojo:mash_shell") | 88 if (name == "mojo:mash_session") |
89 return make_scoped_ptr(new mash::shell::ShellApplicationDelegate); | 89 return make_scoped_ptr(new mash::session::Session); |
90 if (name == "mojo:mus") | 90 if (name == "mojo:mus") |
91 return make_scoped_ptr(new mus::MandolineUIServicesApp); | 91 return make_scoped_ptr(new mus::MandolineUIServicesApp); |
92 if (name == "mojo:quick_launch") | 92 if (name == "mojo:quick_launch") |
93 return make_scoped_ptr(new mash::quick_launch::QuickLaunchApplication); | 93 return make_scoped_ptr(new mash::quick_launch::QuickLaunchApplication); |
94 if (name == "mojo:resource_provider") { | 94 if (name == "mojo:resource_provider") { |
95 return make_scoped_ptr( | 95 return make_scoped_ptr( |
96 new resource_provider::ResourceProviderApp("mojo:resource_provider")); | 96 new resource_provider::ResourceProviderApp("mojo:resource_provider")); |
97 } | 97 } |
98 #if defined(OS_LINUX) | 98 #if defined(OS_LINUX) |
99 if (name == "mojo:font_service") | 99 if (name == "mojo:font_service") |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 NativeRunnerDelegateImpl native_runner_delegate; | 180 NativeRunnerDelegateImpl native_runner_delegate; |
181 mojo::shell::BackgroundShell background_shell; | 181 mojo::shell::BackgroundShell background_shell; |
182 scoped_ptr<mojo::shell::BackgroundShell::InitParams> init_params( | 182 scoped_ptr<mojo::shell::BackgroundShell::InitParams> init_params( |
183 new mojo::shell::BackgroundShell::InitParams); | 183 new mojo::shell::BackgroundShell::InitParams); |
184 init_params->native_runner_delegate = &native_runner_delegate; | 184 init_params->native_runner_delegate = &native_runner_delegate; |
185 background_shell.Init(std::move(init_params)); | 185 background_shell.Init(std::move(init_params)); |
186 shell_client_.reset(new DefaultShellClient); | 186 shell_client_.reset(new DefaultShellClient); |
187 shell_connection_.reset(new mojo::ShellConnection( | 187 shell_connection_.reset(new mojo::ShellConnection( |
188 shell_client_.get(), | 188 shell_client_.get(), |
189 background_shell.CreateShellClientRequest("exe:chrome_mash"))); | 189 background_shell.CreateShellClientRequest("exe:chrome_mash"))); |
190 shell_connection_->connector()->Connect("mojo:mash_shell"); | 190 shell_connection_->connector()->Connect("mojo:mash_session"); |
191 base::MessageLoop::current()->Run(); | 191 base::MessageLoop::current()->Run(); |
192 } | 192 } |
193 | 193 |
194 void MashRunner::RunChild() { | 194 void MashRunner::RunChild() { |
195 base::i18n::InitializeICU(); | 195 base::i18n::InitializeICU(); |
196 mojo::shell::ChildProcessMain( | 196 mojo::shell::ChildProcessMain( |
197 base::Bind(&MashRunner::StartChildApp, base::Unretained(this))); | 197 base::Bind(&MashRunner::StartChildApp, base::Unretained(this))); |
198 } | 198 } |
199 | 199 |
200 void MashRunner::StartChildApp( | 200 void MashRunner::StartChildApp( |
(...skipping 24 matching lines...) Expand all Loading... |
225 scoped_ptr<base::MessageLoop> message_loop; | 225 scoped_ptr<base::MessageLoop> message_loop; |
226 #if defined(OS_LINUX) | 226 #if defined(OS_LINUX) |
227 base::AtExitManager exit_manager; | 227 base::AtExitManager exit_manager; |
228 #endif | 228 #endif |
229 if (!IsChild()) | 229 if (!IsChild()) |
230 message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); | 230 message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |
231 MashRunner mash_runner; | 231 MashRunner mash_runner; |
232 mash_runner.Run(); | 232 mash_runner.Run(); |
233 return 0; | 233 return 0; |
234 } | 234 } |
OLD | NEW |