| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/common/mojo_interface_factory.h" | 5 #include "ash/common/mojo_interface_factory.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/shelf/shelf_controller.h" | 9 #include "ash/common/shelf/shelf_controller.h" |
| 10 #include "ash/common/shutdown_controller.h" | 10 #include "ash/common/shutdown_controller.h" |
| 11 #include "ash/common/system/locale/locale_notification_controller.h" | 11 #include "ash/common/system/locale/locale_notification_controller.h" |
| 12 #include "ash/common/system/tray/system_tray_controller.h" | 12 #include "ash/common/system/tray/system_tray_controller.h" |
| 13 #include "ash/common/wallpaper/wallpaper_controller.h" | 13 #include "ash/common/wallpaper/wallpaper_controller.h" |
| 14 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "services/service_manager/public/cpp/interface_registry.h" | 16 #include "services/service_manager/public/cpp/interface_registry.h" |
| 17 | 17 |
| 18 #if defined(OS_CHROMEOS) |
| 19 #include "ash/common/system/chromeos/network/vpn_list.h" |
| 20 #endif |
| 21 |
| 18 namespace ash { | 22 namespace ash { |
| 19 | 23 |
| 20 namespace { | 24 namespace { |
| 21 | 25 |
| 22 void BindLocaleNotificationControllerOnMainThread( | 26 void BindLocaleNotificationControllerOnMainThread( |
| 23 mojom::LocaleNotificationControllerRequest request) { | 27 mojom::LocaleNotificationControllerRequest request) { |
| 24 WmShell::Get()->locale_notification_controller()->BindRequest( | 28 WmShell::Get()->locale_notification_controller()->BindRequest( |
| 25 std::move(request)); | 29 std::move(request)); |
| 26 } | 30 } |
| 27 | 31 |
| 28 void BindShelfRequestOnMainThread(mojom::ShelfControllerRequest request) { | 32 void BindShelfRequestOnMainThread(mojom::ShelfControllerRequest request) { |
| 29 WmShell::Get()->shelf_controller()->BindRequest(std::move(request)); | 33 WmShell::Get()->shelf_controller()->BindRequest(std::move(request)); |
| 30 } | 34 } |
| 31 | 35 |
| 32 void BindShutdownControllerRequestOnMainThread( | 36 void BindShutdownControllerRequestOnMainThread( |
| 33 mojom::ShutdownControllerRequest request) { | 37 mojom::ShutdownControllerRequest request) { |
| 34 WmShell::Get()->shutdown_controller()->BindRequest(std::move(request)); | 38 WmShell::Get()->shutdown_controller()->BindRequest(std::move(request)); |
| 35 } | 39 } |
| 36 | 40 |
| 37 void BindSystemTrayRequestOnMainThread(mojom::SystemTrayRequest request) { | 41 void BindSystemTrayRequestOnMainThread(mojom::SystemTrayRequest request) { |
| 38 WmShell::Get()->system_tray_controller()->BindRequest(std::move(request)); | 42 WmShell::Get()->system_tray_controller()->BindRequest(std::move(request)); |
| 39 } | 43 } |
| 40 | 44 |
| 45 #if defined(OS_CHROMEOS) |
| 46 void BindVpnListRequestOnMainThread(mojom::VpnListRequest request) { |
| 47 WmShell::Get()->vpn_list()->BindRequest(std::move(request)); |
| 48 } |
| 49 #endif |
| 50 |
| 41 void BindWallpaperRequestOnMainThread( | 51 void BindWallpaperRequestOnMainThread( |
| 42 mojom::WallpaperControllerRequest request) { | 52 mojom::WallpaperControllerRequest request) { |
| 43 WmShell::Get()->wallpaper_controller()->BindRequest(std::move(request)); | 53 WmShell::Get()->wallpaper_controller()->BindRequest(std::move(request)); |
| 44 } | 54 } |
| 45 | 55 |
| 46 } // namespace | 56 } // namespace |
| 47 | 57 |
| 48 namespace mojo_interface_factory { | 58 namespace mojo_interface_factory { |
| 49 | 59 |
| 50 void RegisterInterfaces( | 60 void RegisterInterfaces( |
| 51 service_manager::InterfaceRegistry* registry, | 61 service_manager::InterfaceRegistry* registry, |
| 52 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) { | 62 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) { |
| 53 registry->AddInterface( | 63 registry->AddInterface( |
| 54 base::Bind(&BindLocaleNotificationControllerOnMainThread), | 64 base::Bind(&BindLocaleNotificationControllerOnMainThread), |
| 55 main_thread_task_runner); | 65 main_thread_task_runner); |
| 56 registry->AddInterface(base::Bind(&BindShelfRequestOnMainThread), | 66 registry->AddInterface(base::Bind(&BindShelfRequestOnMainThread), |
| 57 main_thread_task_runner); | 67 main_thread_task_runner); |
| 58 registry->AddInterface(base::Bind(&BindShutdownControllerRequestOnMainThread), | 68 registry->AddInterface(base::Bind(&BindShutdownControllerRequestOnMainThread), |
| 59 main_thread_task_runner); | 69 main_thread_task_runner); |
| 60 registry->AddInterface(base::Bind(&BindSystemTrayRequestOnMainThread), | 70 registry->AddInterface(base::Bind(&BindSystemTrayRequestOnMainThread), |
| 61 main_thread_task_runner); | 71 main_thread_task_runner); |
| 72 #if defined(OS_CHROMEOS) |
| 73 registry->AddInterface(base::Bind(&BindVpnListRequestOnMainThread), |
| 74 main_thread_task_runner); |
| 75 #endif |
| 62 registry->AddInterface(base::Bind(&BindWallpaperRequestOnMainThread), | 76 registry->AddInterface(base::Bind(&BindWallpaperRequestOnMainThread), |
| 63 main_thread_task_runner); | 77 main_thread_task_runner); |
| 64 } | 78 } |
| 65 | 79 |
| 66 } // namespace mojo_interface_factory | 80 } // namespace mojo_interface_factory |
| 67 | 81 |
| 68 } // namespace ash | 82 } // namespace ash |
| OLD | NEW |