| Index: chrome/browser/ui/ash/ash_util.cc
|
| diff --git a/chrome/browser/ui/ash/ash_util.cc b/chrome/browser/ui/ash/ash_util.cc
|
| index 4609b798fcf30f25527331ce5e2b303ff2ce8bd3..3209292593108b070f44062bc5ec53811fb5f314 100644
|
| --- a/chrome/browser/ui/ash/ash_util.cc
|
| +++ b/chrome/browser/ui/ash/ash_util.cc
|
| @@ -5,22 +5,58 @@
|
| #include "chrome/browser/ui/ash/ash_util.h"
|
|
|
| #include "ash/common/accelerators/accelerator_controller.h"
|
| +#include "ash/common/mojo_interface_factory.h"
|
| #include "ash/common/wm_shell.h"
|
| +#include "base/macros.h"
|
| #include "build/build_config.h"
|
| #include "chrome/browser/ui/ash/ash_init.h"
|
| #include "content/public/common/service_names.mojom.h"
|
| +#include "services/service_manager/public/cpp/interface_registry.h"
|
| +#include "services/service_manager/public/cpp/service.h"
|
| +#include "services/service_manager/public/interfaces/interface_provider_spec.mojom.h"
|
| #include "services/service_manager/runner/common/client_util.h"
|
| #include "ui/aura/window_event_dispatcher.h"
|
|
|
| namespace ash_util {
|
|
|
| +namespace {
|
| +
|
| +class EmbeddedAshService : public service_manager::Service {
|
| + public:
|
| + explicit EmbeddedAshService(
|
| + const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
|
| + : task_runner_(task_runner),
|
| + interfaces_(service_manager::mojom::kServiceManager_ConnectorSpec) {}
|
| + ~EmbeddedAshService() override {}
|
| +
|
| + // service_manager::Service:
|
| + void OnStart() override {
|
| + ash::mojo_interface_factory::RegisterInterfaces(&interfaces_, task_runner_);
|
| + }
|
| +
|
| + void OnBindInterface(const service_manager::ServiceInfo& remote_info,
|
| + const std::string& interface_name,
|
| + mojo::ScopedMessagePipeHandle handle) override {
|
| + interfaces_.BindInterface(interface_name, std::move(handle));
|
| + }
|
| +
|
| + private:
|
| + const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
|
| + service_manager::InterfaceRegistry interfaces_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(EmbeddedAshService);
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| +// TODO(rockot): Remove this.
|
| const char* GetAshServiceName() {
|
| - // Under mash the ash process provides the service.
|
| - if (chrome::IsRunningInMash())
|
| - return "ash";
|
| + return "ash";
|
| +}
|
|
|
| - // Under classic ash the browser process provides the service.
|
| - return content::mojom::kBrowserServiceName;
|
| +std::unique_ptr<service_manager::Service> CreateEmbeddedAshService(
|
| + const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
|
| + return base::MakeUnique<EmbeddedAshService>(task_runner);
|
| }
|
|
|
| } // namespace ash_util
|
|
|