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

Unified Diff: chrome/browser/ui/ash/ash_util.cc

Issue 2695803004: Make browser process a singleton service (Closed)
Patch Set: . Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/ash/ash_util.h ('k') | chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/ui/ash/ash_util.h ('k') | chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698