blob: c8eab24b79be8720e29115c5040156feedcdde94 [file] [log] [blame]
James Cookb0bf8e82017-04-09 17:01:441// Copyright 2016 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ash/mojo_interface_factory.h"
6
7#include <utility>
8
9#include "ash/accelerators/accelerator_controller.h"
10#include "ash/cast_config_controller.h"
xiaoyinh2bbdd102017-05-18 23:29:4211#include "ash/login/lock_screen_controller.h"
James Cookb0bf8e82017-04-09 17:01:4412#include "ash/media_controller.h"
13#include "ash/new_window_controller.h"
14#include "ash/session/session_controller.h"
15#include "ash/shelf/shelf_controller.h"
16#include "ash/shell.h"
17#include "ash/shell_delegate.h"
18#include "ash/shutdown_controller.h"
19#include "ash/system/locale/locale_notification_controller.h"
20#include "ash/system/network/vpn_list.h"
21#include "ash/system/tray/system_tray_controller.h"
tbarzicc78da1ff92017-05-08 20:46:1522#include "ash/tray_action/tray_action.h"
James Cookb0bf8e82017-04-09 17:01:4423#include "ash/wallpaper/wallpaper_controller.h"
oshima341337af2017-05-26 23:34:2324#include "ash/wm/maximize_mode/maximize_mode_controller.h"
James Cookb0bf8e82017-04-09 17:01:4425#include "base/bind.h"
Gabriel Charette5ff87ce2017-05-16 18:03:4526#include "base/single_thread_task_runner.h"
bena5c972c2017-05-04 01:38:4327#include "services/service_manager/public/cpp/bind_source_info.h"
James Cookb0bf8e82017-04-09 17:01:4428#include "services/service_manager/public/cpp/binder_registry.h"
29#include "ui/app_list/presenter/app_list.h"
30
31namespace ash {
32
33namespace {
34
35void BindAcceleratorControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4336 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4437 mojom::AcceleratorControllerRequest request) {
38 Shell::Get()->accelerator_controller()->BindRequest(std::move(request));
39}
40
bena5c972c2017-05-04 01:38:4341void BindAppListRequestOnMainThread(
42 const service_manager::BindSourceInfo& source_info,
43 app_list::mojom::AppListRequest request) {
James Cookb0bf8e82017-04-09 17:01:4444 Shell::Get()->app_list()->BindRequest(std::move(request));
45}
46
bena5c972c2017-05-04 01:38:4347void BindCastConfigOnMainThread(
48 const service_manager::BindSourceInfo& source_info,
49 mojom::CastConfigRequest request) {
James Cookb0bf8e82017-04-09 17:01:4450 Shell::Get()->cast_config()->BindRequest(std::move(request));
51}
52
53void BindLocaleNotificationControllerOnMainThread(
bena5c972c2017-05-04 01:38:4354 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4455 mojom::LocaleNotificationControllerRequest request) {
56 Shell::Get()->locale_notification_controller()->BindRequest(
57 std::move(request));
58}
59
xiaoyinh2bbdd102017-05-18 23:29:4260void BindLockScreenRequestOnMainThread(
61 const service_manager::BindSourceInfo& source_info,
62 mojom::LockScreenRequest request) {
63 Shell::Get()->lock_screen_controller()->BindRequest(std::move(request));
64}
65
James Cookb0bf8e82017-04-09 17:01:4466void BindMediaControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4367 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4468 mojom::MediaControllerRequest request) {
69 Shell::Get()->media_controller()->BindRequest(std::move(request));
70}
71
72void BindNewWindowControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4373 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4474 mojom::NewWindowControllerRequest request) {
75 Shell::Get()->new_window_controller()->BindRequest(std::move(request));
76}
77
78void BindSessionControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4379 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4480 mojom::SessionControllerRequest request) {
81 Shell::Get()->session_controller()->BindRequest(std::move(request));
82}
83
bena5c972c2017-05-04 01:38:4384void BindShelfRequestOnMainThread(
85 const service_manager::BindSourceInfo& source_info,
86 mojom::ShelfControllerRequest request) {
James Cookb0bf8e82017-04-09 17:01:4487 Shell::Get()->shelf_controller()->BindRequest(std::move(request));
88}
89
90void BindShutdownControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4391 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4492 mojom::ShutdownControllerRequest request) {
93 Shell::Get()->shutdown_controller()->BindRequest(std::move(request));
94}
95
bena5c972c2017-05-04 01:38:4396void BindSystemTrayRequestOnMainThread(
97 const service_manager::BindSourceInfo& source_info,
98 mojom::SystemTrayRequest request) {
James Cookb0bf8e82017-04-09 17:01:4499 Shell::Get()->system_tray_controller()->BindRequest(std::move(request));
100}
101
bena5c972c2017-05-04 01:38:43102void BindTouchViewRequestOnMainThread(
103 const service_manager::BindSourceInfo& source_info,
104 mojom::TouchViewManagerRequest request) {
oshima341337af2017-05-26 23:34:23105 Shell::Get()->maximize_mode_controller()->BindRequest(std::move(request));
James Cookb0bf8e82017-04-09 17:01:44106}
107
tbarzicc78da1ff92017-05-08 20:46:15108void BindTrayActionRequestOnMainThread(
109 const service_manager::BindSourceInfo& source_info,
110 mojom::TrayActionRequest request) {
111 Shell::Get()->tray_action()->BindRequest(std::move(request));
112}
113
bena5c972c2017-05-04 01:38:43114void BindVpnListRequestOnMainThread(
115 const service_manager::BindSourceInfo& source_info,
116 mojom::VpnListRequest request) {
James Cookb0bf8e82017-04-09 17:01:44117 Shell::Get()->vpn_list()->BindRequest(std::move(request));
118}
119
120void BindWallpaperRequestOnMainThread(
bena5c972c2017-05-04 01:38:43121 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:44122 mojom::WallpaperControllerRequest request) {
123 Shell::Get()->wallpaper_controller()->BindRequest(std::move(request));
124}
125
126} // namespace
127
128namespace mojo_interface_factory {
129
130void RegisterInterfaces(
131 service_manager::BinderRegistry* registry,
132 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) {
133 registry->AddInterface(
134 base::Bind(&BindAcceleratorControllerRequestOnMainThread),
135 main_thread_task_runner);
136 registry->AddInterface(base::Bind(&BindAppListRequestOnMainThread),
137 main_thread_task_runner);
138 registry->AddInterface(base::Bind(&BindCastConfigOnMainThread),
139 main_thread_task_runner);
140 registry->AddInterface(
141 base::Bind(&BindLocaleNotificationControllerOnMainThread),
142 main_thread_task_runner);
xiaoyinh2bbdd102017-05-18 23:29:42143 registry->AddInterface(base::Bind(&BindLockScreenRequestOnMainThread),
144 main_thread_task_runner);
James Cookb0bf8e82017-04-09 17:01:44145 registry->AddInterface(base::Bind(&BindMediaControllerRequestOnMainThread),
146 main_thread_task_runner);
147 registry->AddInterface(
148 base::Bind(&BindNewWindowControllerRequestOnMainThread),
149 main_thread_task_runner);
150 registry->AddInterface(base::Bind(&BindSessionControllerRequestOnMainThread),
151 main_thread_task_runner);
152 registry->AddInterface(base::Bind(&BindShelfRequestOnMainThread),
153 main_thread_task_runner);
154 registry->AddInterface(base::Bind(&BindShutdownControllerRequestOnMainThread),
155 main_thread_task_runner);
156 registry->AddInterface(base::Bind(&BindSystemTrayRequestOnMainThread),
157 main_thread_task_runner);
158 registry->AddInterface(base::Bind(&BindTouchViewRequestOnMainThread),
159 main_thread_task_runner);
tbarzicc78da1ff92017-05-08 20:46:15160 registry->AddInterface(base::Bind(&BindTrayActionRequestOnMainThread),
161 main_thread_task_runner);
James Cookb0bf8e82017-04-09 17:01:44162 registry->AddInterface(base::Bind(&BindVpnListRequestOnMainThread),
163 main_thread_task_runner);
164 registry->AddInterface(base::Bind(&BindWallpaperRequestOnMainThread),
165 main_thread_task_runner);
166}
167
168} // namespace mojo_interface_factory
169
170} // namespace ash