Index: chrome/app/mash/mash_runner.cc |
diff --git a/chrome/app/mash/mash_runner.cc b/chrome/app/mash/mash_runner.cc |
index 9787b9b16ef9a0c2c966ce75f3d7d80dede39db5..84b9cda5901f3fed6aa4caa12545bad64d34b469 100644 |
--- a/chrome/app/mash/mash_runner.cc |
+++ b/chrome/app/mash/mash_runner.cc |
@@ -4,8 +4,6 @@ |
#include "chrome/app/mash/mash_runner.h" |
-#include "ash/mus/window_manager_application.h" |
-#include "ash/touch_hud/mus/touch_hud_application.h" |
#include "base/at_exit.h" |
#include "base/bind.h" |
#include "base/command_line.h" |
@@ -19,10 +17,7 @@ |
#include "components/tracing/common/trace_to_console.h" |
#include "components/tracing/common/tracing_switches.h" |
#include "content/public/common/content_switches.h" |
-#include "mash/app_driver/app_driver.h" |
-#include "mash/quick_launch/quick_launch.h" |
-#include "mash/session/session.h" |
-#include "mash/task_viewer/task_viewer.h" |
+#include "mash/package/mash_packaged_service.h" |
#include "mojo/public/cpp/bindings/binding_set.h" |
#include "services/shell/background/background_shell.h" |
#include "services/shell/native_runner_delegate.h" |
@@ -33,11 +28,6 @@ |
#include "services/shell/public/interfaces/service_factory.mojom.h" |
#include "services/shell/runner/common/switches.h" |
#include "services/shell/runner/host/child_process_base.h" |
-#include "services/ui/service.h" |
- |
-#if defined(OS_LINUX) |
-#include "components/font_service/font_service_app.h" |
-#endif |
using shell::mojom::ServiceFactory; |
@@ -46,75 +36,6 @@ namespace { |
// kProcessType used to identify child processes. |
const char* kMashChild = "mash-child"; |
-// Service responsible for starting the appropriate app. |
-class DefaultService : public shell::Service, |
- public ServiceFactory, |
- public shell::InterfaceFactory<ServiceFactory> { |
- public: |
- DefaultService() {} |
- ~DefaultService() override {} |
- |
- // shell::Service: |
- bool OnConnect(const shell::Identity& remote_identity, |
- shell::InterfaceRegistry* registry) override { |
- registry->AddInterface<ServiceFactory>(this); |
- return true; |
- } |
- |
- // shell::InterfaceFactory<ServiceFactory> |
- void Create(const shell::Identity& remote_identity, |
- mojo::InterfaceRequest<ServiceFactory> request) override { |
- service_factory_bindings_.AddBinding(this, std::move(request)); |
- } |
- |
- // ServiceFactory: |
- void CreateService(shell::mojom::ServiceRequest request, |
- const std::string& mojo_name) override { |
- if (service_) { |
- LOG(ERROR) << "request to create additional service " << mojo_name; |
- return; |
- } |
- service_ = CreateService(mojo_name); |
- if (service_) { |
- service_->set_context(base::MakeUnique<shell::ServiceContext>( |
- service_.get(), std::move(request))); |
- return; |
- } |
- LOG(ERROR) << "unknown name " << mojo_name; |
- NOTREACHED(); |
- } |
- |
- private: |
- // TODO(sky): move this into mash. |
- std::unique_ptr<shell::Service> CreateService( |
- const std::string& name) { |
- if (name == "mojo:ash") |
- return base::WrapUnique(new ash::mus::WindowManagerApplication); |
- if (name == "mojo:touch_hud") |
- return base::WrapUnique(new ash::touch_hud::TouchHudApplication); |
- if (name == "mojo:mash_session") |
- return base::WrapUnique(new mash::session::Session); |
- if (name == "mojo:ui") |
- return base::WrapUnique(new ui::Service); |
- if (name == "mojo:quick_launch") |
- return base::WrapUnique(new mash::quick_launch::QuickLaunch); |
- if (name == "mojo:task_viewer") |
- return base::WrapUnique(new mash::task_viewer::TaskViewer); |
-#if defined(OS_LINUX) |
- if (name == "mojo:font_service") |
- return base::WrapUnique(new font_service::FontServiceApp); |
-#endif |
- if (name == "mojo:app_driver") |
- return base::WrapUnique(new mash::app_driver::AppDriver); |
- return nullptr; |
- } |
- |
- mojo::BindingSet<ServiceFactory> service_factory_bindings_; |
- std::unique_ptr<shell::Service> service_; |
- |
- DISALLOW_COPY_AND_ASSIGN(DefaultService); |
-}; |
- |
bool IsChild() { |
return base::CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kProcessType) && |
@@ -188,7 +109,7 @@ void MashRunner::RunMain() { |
new shell::BackgroundShell::InitParams); |
init_params->native_runner_delegate = &native_runner_delegate; |
background_shell.Init(std::move(init_params)); |
- service_.reset(new DefaultService); |
+ service_.reset(new mash::MashPackagedService); |
service_->set_context(base::MakeUnique<shell::ServiceContext>( |
service_.get(), |
background_shell.CreateServiceRequest("exe:chrome_mash"))); |
@@ -206,7 +127,7 @@ void MashRunner::StartChildApp( |
shell::mojom::ServiceRequest service_request) { |
// TODO(sky): use MessagePumpMojo. |
base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); |
- service_.reset(new DefaultService); |
+ service_.reset(new mash::MashPackagedService); |
service_->set_context(base::MakeUnique<shell::ServiceContext>( |
service_.get(), std::move(service_request))); |
message_loop.Run(); |