blob: 78ea5f4c64244790af61420aa382d6f261de0e8b [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"
xiaoyinh2bbdd102017-05-18 23:29:4212#include "ash/login/lock_screen_controller.h"
James Cookb0bf8e82017-04-09 17:01:4413#include "ash/media_controller.h"
14#include "ash/new_window_controller.h"
15#include "ash/session/session_controller.h"
16#include "ash/shelf/shelf_controller.h"
17#include "ash/shell.h"
18#include "ash/shell_delegate.h"
19#include "ash/shutdown_controller.h"
20#include "ash/system/locale/locale_notification_controller.h"
21#include "ash/system/network/vpn_list.h"
22#include "ash/system/tray/system_tray_controller.h"
tbarzicc78da1ff92017-05-08 20:46:1523#include "ash/tray_action/tray_action.h"
James Cookb0bf8e82017-04-09 17:01:4424#include "ash/wallpaper/wallpaper_controller.h"
oshima341337af2017-05-26 23:34:2325#include "ash/wm/maximize_mode/maximize_mode_controller.h"
James Cookb0bf8e82017-04-09 17:01:4426#include "base/bind.h"
Gabriel Charette5ff87ce2017-05-16 18:03:4527#include "base/single_thread_task_runner.h"
bena5c972c2017-05-04 01:38:4328#include "services/service_manager/public/cpp/bind_source_info.h"
James Cookb0bf8e82017-04-09 17:01:4429#include "services/service_manager/public/cpp/binder_registry.h"
30#include "ui/app_list/presenter/app_list.h"
31
32namespace ash {
33
34namespace {
35
36void BindAcceleratorControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4337 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4438 mojom::AcceleratorControllerRequest request) {
39 Shell::Get()->accelerator_controller()->BindRequest(std::move(request));
40}
41
bena5c972c2017-05-04 01:38:4342void BindAppListRequestOnMainThread(
43 const service_manager::BindSourceInfo& source_info,
44 app_list::mojom::AppListRequest request) {
James Cookb0bf8e82017-04-09 17:01:4445 Shell::Get()->app_list()->BindRequest(std::move(request));
46}
47
Scott Violetd64dac12017-06-02 21:50:0848void BindAshDisplayControllerRequestOnMainThread(
49 const service_manager::BindSourceInfo& source_info,
50 mojom::AshDisplayControllerRequest request) {
51 Shell::Get()->ash_display_controller()->BindRequest(std::move(request));
52}
53
bena5c972c2017-05-04 01:38:4354void BindCastConfigOnMainThread(
55 const service_manager::BindSourceInfo& source_info,
56 mojom::CastConfigRequest request) {
James Cookb0bf8e82017-04-09 17:01:4457 Shell::Get()->cast_config()->BindRequest(std::move(request));
58}
59
60void BindLocaleNotificationControllerOnMainThread(
bena5c972c2017-05-04 01:38:4361 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4462 mojom::LocaleNotificationControllerRequest request) {
63 Shell::Get()->locale_notification_controller()->BindRequest(
64 std::move(request));
65}
66
xiaoyinh2bbdd102017-05-18 23:29:4267void BindLockScreenRequestOnMainThread(
68 const service_manager::BindSourceInfo& source_info,
69 mojom::LockScreenRequest request) {
70 Shell::Get()->lock_screen_controller()->BindRequest(std::move(request));
71}
72
James Cookb0bf8e82017-04-09 17:01:4473void BindMediaControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4374 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4475 mojom::MediaControllerRequest request) {
76 Shell::Get()->media_controller()->BindRequest(std::move(request));
77}
78
79void BindNewWindowControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4380 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4481 mojom::NewWindowControllerRequest request) {
82 Shell::Get()->new_window_controller()->BindRequest(std::move(request));
83}
84
85void BindSessionControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4386 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4487 mojom::SessionControllerRequest request) {
88 Shell::Get()->session_controller()->BindRequest(std::move(request));
89}
90
bena5c972c2017-05-04 01:38:4391void BindShelfRequestOnMainThread(
92 const service_manager::BindSourceInfo& source_info,
93 mojom::ShelfControllerRequest request) {
James Cookb0bf8e82017-04-09 17:01:4494 Shell::Get()->shelf_controller()->BindRequest(std::move(request));
95}
96
97void BindShutdownControllerRequestOnMainThread(
bena5c972c2017-05-04 01:38:4398 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:4499 mojom::ShutdownControllerRequest request) {
100 Shell::Get()->shutdown_controller()->BindRequest(std::move(request));
101}
102
bena5c972c2017-05-04 01:38:43103void BindSystemTrayRequestOnMainThread(
104 const service_manager::BindSourceInfo& source_info,
105 mojom::SystemTrayRequest request) {
James Cookb0bf8e82017-04-09 17:01:44106 Shell::Get()->system_tray_controller()->BindRequest(std::move(request));
107}
108
bena5c972c2017-05-04 01:38:43109void BindTouchViewRequestOnMainThread(
110 const service_manager::BindSourceInfo& source_info,
111 mojom::TouchViewManagerRequest request) {
oshima341337af2017-05-26 23:34:23112 Shell::Get()->maximize_mode_controller()->BindRequest(std::move(request));
James Cookb0bf8e82017-04-09 17:01:44113}
114
tbarzicc78da1ff92017-05-08 20:46:15115void BindTrayActionRequestOnMainThread(
116 const service_manager::BindSourceInfo& source_info,
117 mojom::TrayActionRequest request) {
118 Shell::Get()->tray_action()->BindRequest(std::move(request));
119}
120
bena5c972c2017-05-04 01:38:43121void BindVpnListRequestOnMainThread(
122 const service_manager::BindSourceInfo& source_info,
123 mojom::VpnListRequest request) {
James Cookb0bf8e82017-04-09 17:01:44124 Shell::Get()->vpn_list()->BindRequest(std::move(request));
125}
126
127void BindWallpaperRequestOnMainThread(
bena5c972c2017-05-04 01:38:43128 const service_manager::BindSourceInfo& source_info,
James Cookb0bf8e82017-04-09 17:01:44129 mojom::WallpaperControllerRequest request) {
130 Shell::Get()->wallpaper_controller()->BindRequest(std::move(request));
131}
132
133} // namespace
134
135namespace mojo_interface_factory {
136
137void RegisterInterfaces(
138 service_manager::BinderRegistry* registry,
139 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) {
140 registry->AddInterface(
141 base::Bind(&BindAcceleratorControllerRequestOnMainThread),
142 main_thread_task_runner);
143 registry->AddInterface(base::Bind(&BindAppListRequestOnMainThread),
144 main_thread_task_runner);
Scott Violetd64dac12017-06-02 21:50:08145 registry->AddInterface(
146 base::Bind(&BindAshDisplayControllerRequestOnMainThread),
147 main_thread_task_runner);
James Cookb0bf8e82017-04-09 17:01:44148 registry->AddInterface(base::Bind(&BindCastConfigOnMainThread),
149 main_thread_task_runner);
150 registry->AddInterface(
151 base::Bind(&BindLocaleNotificationControllerOnMainThread),
152 main_thread_task_runner);
xiaoyinh2bbdd102017-05-18 23:29:42153 registry->AddInterface(base::Bind(&BindLockScreenRequestOnMainThread),
154 main_thread_task_runner);
James Cookb0bf8e82017-04-09 17:01:44155 registry->AddInterface(base::Bind(&BindMediaControllerRequestOnMainThread),
156 main_thread_task_runner);
157 registry->AddInterface(
158 base::Bind(&BindNewWindowControllerRequestOnMainThread),
159 main_thread_task_runner);
160 registry->AddInterface(base::Bind(&BindSessionControllerRequestOnMainThread),
161 main_thread_task_runner);
162 registry->AddInterface(base::Bind(&BindShelfRequestOnMainThread),
163 main_thread_task_runner);
164 registry->AddInterface(base::Bind(&BindShutdownControllerRequestOnMainThread),
165 main_thread_task_runner);
166 registry->AddInterface(base::Bind(&BindSystemTrayRequestOnMainThread),
167 main_thread_task_runner);
168 registry->AddInterface(base::Bind(&BindTouchViewRequestOnMainThread),
169 main_thread_task_runner);
tbarzicc78da1ff92017-05-08 20:46:15170 registry->AddInterface(base::Bind(&BindTrayActionRequestOnMainThread),
171 main_thread_task_runner);
James Cookb0bf8e82017-04-09 17:01:44172 registry->AddInterface(base::Bind(&BindVpnListRequestOnMainThread),
173 main_thread_task_runner);
174 registry->AddInterface(base::Bind(&BindWallpaperRequestOnMainThread),
175 main_thread_task_runner);
176}
177
178} // namespace mojo_interface_factory
179
180} // namespace ash