| 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/shell/shell_application_delegate.h" |
| 21 #include "mash/wm/window_manager_application.h" | 21 #include "mash/wm/window_manager_application.h" |
| 22 #include "mojo/common/mojo_scheme_register.h" | 22 #include "mojo/common/mojo_scheme_register.h" |
| 23 #include "mojo/public/cpp/bindings/binding_set.h" | 23 #include "mojo/public/cpp/bindings/binding_set.h" |
| 24 #include "mojo/shell/background/background_shell.h" | 24 #include "mojo/shell/background/background_shell.h" |
| 25 #include "mojo/shell/identity.h" | 25 #include "mojo/shell/identity.h" |
| 26 #include "mojo/shell/native_runner_delegate.h" | 26 #include "mojo/shell/native_runner_delegate.h" |
| 27 #include "mojo/shell/public/cpp/connector.h" |
| 27 #include "mojo/shell/public/cpp/shell_client.h" | 28 #include "mojo/shell/public/cpp/shell_client.h" |
| 28 #include "mojo/shell/public/cpp/shell_connection.h" | 29 #include "mojo/shell/public/cpp/shell_connection.h" |
| 29 #include "mojo/shell/public/interfaces/shell_client_factory.mojom.h" | 30 #include "mojo/shell/public/interfaces/shell_client_factory.mojom.h" |
| 30 #include "mojo/shell/runner/common/switches.h" | 31 #include "mojo/shell/runner/common/switches.h" |
| 31 #include "mojo/shell/runner/host/child_process_base.h" | 32 #include "mojo/shell/runner/host/child_process_base.h" |
| 32 #include "url/gurl.h" | 33 #include "url/gurl.h" |
| 33 #include "url/url_util.h" | 34 #include "url/url_util.h" |
| 34 | 35 |
| 35 #if defined(OS_LINUX) | 36 #if defined(OS_LINUX) |
| 36 #include "components/font_service/font_service_app.h" | 37 #include "components/font_service/font_service_app.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 mojo::shell::BackgroundShell background_shell; | 184 mojo::shell::BackgroundShell background_shell; |
| 184 scoped_ptr<mojo::shell::BackgroundShell::InitParams> init_params( | 185 scoped_ptr<mojo::shell::BackgroundShell::InitParams> init_params( |
| 185 new mojo::shell::BackgroundShell::InitParams); | 186 new mojo::shell::BackgroundShell::InitParams); |
| 186 init_params->native_runner_delegate = &native_runner_delegate; | 187 init_params->native_runner_delegate = &native_runner_delegate; |
| 187 background_shell.Init(std::move(init_params)); | 188 background_shell.Init(std::move(init_params)); |
| 188 shell_client_.reset(new DefaultShellClient); | 189 shell_client_.reset(new DefaultShellClient); |
| 189 shell_connection_.reset(new mojo::ShellConnection( | 190 shell_connection_.reset(new mojo::ShellConnection( |
| 190 shell_client_.get(), | 191 shell_client_.get(), |
| 191 background_shell.CreateShellClientRequest(GURL("exe:chrome_mash")))); | 192 background_shell.CreateShellClientRequest(GURL("exe:chrome_mash")))); |
| 192 shell_connection_->WaitForInitialize(); | 193 shell_connection_->WaitForInitialize(); |
| 193 static_cast<mojo::Shell*>(shell_connection_.get()) | 194 shell_connection_->connector()->Connect("mojo:mash_shell"); |
| 194 ->Connect("mojo:mash_shell"); | |
| 195 base::MessageLoop::current()->Run(); | 195 base::MessageLoop::current()->Run(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void MashRunner::RunChild() { | 198 void MashRunner::RunChild() { |
| 199 base::i18n::InitializeICU(); | 199 base::i18n::InitializeICU(); |
| 200 mojo::shell::ChildProcessMain( | 200 mojo::shell::ChildProcessMain( |
| 201 base::Bind(&MashRunner::StartChildApp, base::Unretained(this))); | 201 base::Bind(&MashRunner::StartChildApp, base::Unretained(this))); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void MashRunner::StartChildApp( | 204 void MashRunner::StartChildApp( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 230 scoped_ptr<base::MessageLoop> message_loop; | 230 scoped_ptr<base::MessageLoop> message_loop; |
| 231 #if defined(OS_LINUX) | 231 #if defined(OS_LINUX) |
| 232 base::AtExitManager exit_manager; | 232 base::AtExitManager exit_manager; |
| 233 #endif | 233 #endif |
| 234 if (!IsChild()) | 234 if (!IsChild()) |
| 235 message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); | 235 message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |
| 236 MashRunner mash_runner; | 236 MashRunner mash_runner; |
| 237 mash_runner.Run(); | 237 mash_runner.Run(); |
| 238 return 0; | 238 return 0; |
| 239 } | 239 } |
| OLD | NEW |