blob: d7bd8295056406f52d1e10aa72c80135be4a9f92 [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"
Scott Violetd64dac12017-06-02 21:50:0811#include "ash/display/ash_display_controller.h"
James Cookfdee0242017-06-20 14:14:0012#include "ash/ime/ime_controller.h"
xiaoyinh2bbdd102017-05-18 23:29:4213#include "ash/login/lock_screen_controller.h"
James Cookb0bf8e82017-04-09 17:01:4414#include "ash/media_controller.h"
15#include "ash/new_window_controller.h"
16#include "ash/session/session_controller.h"
17#include "ash/shelf/shelf_controller.h"
18#include "ash/shell.h"
19#include "ash/shell_delegate.h"
20#include "ash/shutdown_controller.h"
21#include "ash/system/locale/locale_notification_controller.h"
22#include "ash/system/network/vpn_list.h"
afakhryee3e2fa2017-06-15 17:45:4123#include "ash/system/night_light/night_light_controller.h"
James Cookb0bf8e82017-04-09 17:01:4424#include "ash/system/tray/system_tray_controller.h"
tbarzicc78da1ff92017-05-08 20:46:1525#include "ash/tray_action/tray_action.h"
James Cookb0bf8e82017-04-09 17:01:4426#include "ash/wallpaper/wallpaper_controller.h"
oshima341337af2017-05-26 23:34:2327#include "ash/wm/maximize_mode/maximize_mode_controller.h"
James Cookb0bf8e82017-04-09 17:01:4428#include "base/bind.h"
Gabriel Charette5ff87ce2017-05-16 18:03:4529#include "base/single_thread_task_runner.h"
bena5c972c2017-05-04 01:38:4330#include "services/service_manager/public/cpp/bind_source_info.h"
James Cookb0bf8e82017-04-09 17:01:4431#include "ui/app_list/presenter/app_list.h"
32
33namespace ash {
34
35namespace {
36
37void BindAcceleratorControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4338 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4439 mojom::AcceleratorControllerRequest request) {
40 Shell::Get()->accelerator_controller()->BindRequest(std::move(request));
41}
42
bena5c972c2017-05-04 01:38:4343void BindAppListRequestOnMainThread(
44 const service_manager::BindSourceInfo& source_info,
45 app_list::mojom::AppListRequest request) {
James Cookb0bf8e82017-04-09 17:01:4446 Shell::Get()->app_list()->BindRequest(std::move(request));
47}
48
Scott Violetd64dac12017-06-02 21:50:0849void BindAshDisplayControllerRequestOnMainThread(
50 const service_manager::BindSourceInfo& source_info,
51 mojom::AshDisplayControllerRequest request) {
52 Shell::Get()->ash_display_controller()->BindRequest(std::move(request));
53}
54
bena5c972c2017-05-04 01:38:4355void BindCastConfigOnMainThread(
56 const service_manager::BindSourceInfo& source_info,
57 mojom::CastConfigRequest request) {
James Cookb0bf8e82017-04-09 17:01:4458 Shell::Get()->cast_config()->BindRequest(std::move(request));
59}
60
James Cookfdee0242017-06-20 14:14:0061void BindImeControllerRequestOnMainThread(
62 const service_manager::BindSourceInfo& source_info,
63 mojom::ImeControllerRequest request) {
64 Shell::Get()->ime_controller()->BindRequest(std::move(request));
65}
66
James Cookb0bf8e82017-04-09 17:01:4467void BindLocaleNotificationControllerOnMainThread(
bena5c972c2017-05-04 01:38:4368 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4469 mojom::LocaleNotificationControllerRequest request) {
70 Shell::Get()->locale_notification_controller()->BindRequest(
71 std::move(request));
72}
73
xiaoyinh2bbdd102017-05-18 23:29:4274void BindLockScreenRequestOnMainThread(
75 const service_manager::BindSourceInfo& source_info,
76 mojom::LockScreenRequest request) {
77 Shell::Get()->lock_screen_controller()->BindRequest(std::move(request));
78}
79
James Cookb0bf8e82017-04-09 17:01:4480void BindMediaControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4381 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4482 mojom::MediaControllerRequest request) {
83 Shell::Get()->media_controller()->BindRequest(std::move(request));
84}
85
86void BindNewWindowControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4387 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4488 mojom::NewWindowControllerRequest request) {
89 Shell::Get()->new_window_controller()->BindRequest(std::move(request));
90}
91
afakhryee3e2fa2017-06-15 17:45:4192void BindNightLightControllerRequestOnMainThread(
93 const service_manager::BindSourceInfo& source_info,
94 mojom::NightLightControllerRequest request) {
95 Shell::Get()->night_light_controller()->BindRequest(std::move(request));
96}
97
James Cookb0bf8e82017-04-09 17:01:4498void BindSessionControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4399 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:44100 mojom::SessionControllerRequest request) {
101 Shell::Get()->session_controller()->BindRequest(std::move(request));
102}
103
bena5c972c2017-05-04 01:38:43104void BindShelfRequestOnMainThread(
105 const service_manager::BindSourceInfo& source_info,
106 mojom::ShelfControllerRequest request) {
James Cookb0bf8e82017-04-09 17:01:44107 Shell::Get()->shelf_controller()->BindRequest(std::move(request));
108}
109
110void BindShutdownControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:43111 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:44112 mojom::ShutdownControllerRequest request) {
113 Shell::Get()->shutdown_controller()->BindRequest(std::move(request));
114}
115
bena5c972c2017-05-04 01:38:43116void BindSystemTrayRequestOnMainThread(
117 const service_manager::BindSourceInfo& source_info,
118 mojom::SystemTrayRequest request) {
James Cookb0bf8e82017-04-09 17:01:44119 Shell::Get()->system_tray_controller()->BindRequest(std::move(request));
120}
121
bena5c972c2017-05-04 01:38:43122void BindTouchViewRequestOnMainThread(
123 const service_manager::BindSourceInfo& source_info,
124 mojom::TouchViewManagerRequest request) {
oshima341337af2017-05-26 23:34:23125 Shell::Get()->maximize_mode_controller()->BindRequest(std::move(request));
James Cookb0bf8e82017-04-09 17:01:44126}
127
tbarzicc78da1ff92017-05-08 20:46:15128void BindTrayActionRequestOnMainThread(
129 const service_manager::BindSourceInfo& source_info,
130 mojom::TrayActionRequest request) {
131 Shell::Get()->tray_action()->BindRequest(std::move(request));
132}
133
bena5c972c2017-05-04 01:38:43134void BindVpnListRequestOnMainThread(
135 const service_manager::BindSourceInfo& source_info,
136 mojom::VpnListRequest request) {
James Cookb0bf8e82017-04-09 17:01:44137 Shell::Get()->vpn_list()->BindRequest(std::move(request));
138}
139
140void BindWallpaperRequestOnMainThread(
bena5c972c2017-05-04 01:38:43141 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:44142 mojom::WallpaperControllerRequest request) {
143 Shell::Get()->wallpaper_controller()->BindRequest(std::move(request));
144}
145
146} // namespace
147
148namespace mojo_interface_factory {
149
150void RegisterInterfaces(
151 service_manager::BinderRegistry* registry,
152 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) {
153 registry->AddInterface(
154 base::Bind(&BindAcceleratorControllerRequestOnMainThread),
155 main_thread_task_runner);
156 registry->AddInterface(base::Bind(&BindAppListRequestOnMainThread),
157 main_thread_task_runner);
James Cookfdee0242017-06-20 14:14:00158 registry->AddInterface(base::Bind(&BindImeControllerRequestOnMainThread),
159 main_thread_task_runner);
Scott Violetd64dac12017-06-02 21:50:08160 registry->AddInterface(
161 base::Bind(&BindAshDisplayControllerRequestOnMainThread),
162 main_thread_task_runner);
James Cookb0bf8e82017-04-09 17:01:44163 registry->AddInterface(base::Bind(&BindCastConfigOnMainThread),
164 main_thread_task_runner);
165 registry->AddInterface(
166 base::Bind(&BindLocaleNotificationControllerOnMainThread),
167 main_thread_task_runner);
xiaoyinh2bbdd102017-05-18 23:29:42168 registry->AddInterface(base::Bind(&BindLockScreenRequestOnMainThread),
169 main_thread_task_runner);
James Cookb0bf8e82017-04-09 17:01:44170 registry->AddInterface(base::Bind(&BindMediaControllerRequestOnMainThread),
171 main_thread_task_runner);
172 registry->AddInterface(
173 base::Bind(&BindNewWindowControllerRequestOnMainThread),
174 main_thread_task_runner);
afakhryee3e2fa2017-06-15 17:45:41175 if (NightLightController::IsFeatureEnabled()) {
176 registry->AddInterface(
177 base::Bind(&BindNightLightControllerRequestOnMainThread),
178 main_thread_task_runner);
179 }
James Cookb0bf8e82017-04-09 17:01:44180 registry->AddInterface(base::Bind(&BindSessionControllerRequestOnMainThread),
181 main_thread_task_runner);
182 registry->AddInterface(base::Bind(&BindShelfRequestOnMainThread),
183 main_thread_task_runner);
184 registry->AddInterface(base::Bind(&BindShutdownControllerRequestOnMainThread),
185 main_thread_task_runner);
186 registry->AddInterface(base::Bind(&BindSystemTrayRequestOnMainThread),
187 main_thread_task_runner);
188 registry->AddInterface(base::Bind(&BindTouchViewRequestOnMainThread),
189 main_thread_task_runner);
tbarzicc78da1ff92017-05-08 20:46:15190 registry->AddInterface(base::Bind(&BindTrayActionRequestOnMainThread),
191 main_thread_task_runner);
James Cookb0bf8e82017-04-09 17:01:44192 registry->AddInterface(base::Bind(&BindVpnListRequestOnMainThread),
193 main_thread_task_runner);
194 registry->AddInterface(base::Bind(&BindWallpaperRequestOnMainThread),
195 main_thread_task_runner);
196}
197
198} // namespace mojo_interface_factory
199
200} // namespace ash