| 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 "chrome/browser/chromeos/chrome_interface_factory.h" | 5 #include "chrome/browser/chromeos/chrome_interface_factory.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/common/mojo_interface_factory.h" | 10 #include "ash/common/mojo_interface_factory.h" |
| 11 #include "ash/public/interfaces/shutdown.mojom.h" | 11 #include "ash/public/interfaces/shutdown.mojom.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" | 16 #include "base/threading/thread_task_runner_handle.h" |
| 17 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | |
| 18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/ui/ash/app_list/app_list_presenter_service.h" | 19 #include "chrome/browser/ui/ash/app_list/app_list_presenter_service.h" |
| 21 #include "chrome/browser/ui/ash/ash_util.h" | 20 #include "chrome/browser/ui/ash/ash_util.h" |
| 22 #include "chrome/browser/ui/ash/keyboard_ui_service.h" | 21 #include "chrome/browser/ui/ash/keyboard_ui_service.h" |
| 23 #include "chrome/browser/ui/browser_commands.h" | 22 #include "chrome/browser/ui/browser_commands.h" |
| 24 #include "chrome/browser/ui/browser_finder.h" | 23 #include "chrome/browser/ui/browser_finder.h" |
| 25 #include "content/public/common/service_manager_connection.h" | 24 #include "content/public/common/service_manager_connection.h" |
| 26 #include "mash/public/interfaces/launchable.mojom.h" | 25 #include "mash/public/interfaces/launchable.mojom.h" |
| 27 #include "mojo/public/cpp/bindings/binding_set.h" | 26 #include "mojo/public/cpp/bindings/binding_set.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 keyboard_bindings_.AddBinding(keyboard_ui_service_.get(), | 106 keyboard_bindings_.AddBinding(keyboard_ui_service_.get(), |
| 108 std::move(request)); | 107 std::move(request)); |
| 109 } | 108 } |
| 110 | 109 |
| 111 void BindRequest(mash::mojom::LaunchableRequest request) { | 110 void BindRequest(mash::mojom::LaunchableRequest request) { |
| 112 if (!launchable_) | 111 if (!launchable_) |
| 113 launchable_ = base::MakeUnique<ChromeLaunchable>(); | 112 launchable_ = base::MakeUnique<ChromeLaunchable>(); |
| 114 launchable_->ProcessRequest(std::move(request)); | 113 launchable_->ProcessRequest(std::move(request)); |
| 115 } | 114 } |
| 116 | 115 |
| 117 void BindRequest(ash::mojom::WallpaperManagerRequest request) { | |
| 118 WallpaperManager::Get()->BindRequest(std::move(request)); | |
| 119 } | |
| 120 | |
| 121 void BindRequest(app_list::mojom::AppListPresenterRequest request) { | 116 void BindRequest(app_list::mojom::AppListPresenterRequest request) { |
| 122 if (!app_list_presenter_service_) | 117 if (!app_list_presenter_service_) |
| 123 app_list_presenter_service_ = base::MakeUnique<AppListPresenterService>(); | 118 app_list_presenter_service_ = base::MakeUnique<AppListPresenterService>(); |
| 124 app_list_presenter_bindings_.AddBinding(app_list_presenter_service_.get(), | 119 app_list_presenter_bindings_.AddBinding(app_list_presenter_service_.get(), |
| 125 std::move(request)); | 120 std::move(request)); |
| 126 } | 121 } |
| 127 | 122 |
| 128 static base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky factory_; | 123 static base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky factory_; |
| 129 | 124 |
| 130 std::unique_ptr<KeyboardUIService> keyboard_ui_service_; | 125 std::unique_ptr<KeyboardUIService> keyboard_ui_service_; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 151 const service_manager::Identity& remote_identity, | 146 const service_manager::Identity& remote_identity, |
| 152 service_manager::InterfaceRegistry* registry, | 147 service_manager::InterfaceRegistry* registry, |
| 153 service_manager::Connector* connector) { | 148 service_manager::Connector* connector) { |
| 154 // TODO(jamescook): Only register the interfaces needed for a particular | 149 // TODO(jamescook): Only register the interfaces needed for a particular |
| 155 // |remote_identity|. For example, a connection from service:ash needs these, | 150 // |remote_identity|. For example, a connection from service:ash needs these, |
| 156 // but a connection from service:content_gpu does not. | 151 // but a connection from service:content_gpu does not. |
| 157 FactoryImpl::AddFactory<keyboard::mojom::Keyboard>(registry, | 152 FactoryImpl::AddFactory<keyboard::mojom::Keyboard>(registry, |
| 158 main_thread_task_runner_); | 153 main_thread_task_runner_); |
| 159 FactoryImpl::AddFactory<mash::mojom::Launchable>(registry, | 154 FactoryImpl::AddFactory<mash::mojom::Launchable>(registry, |
| 160 main_thread_task_runner_); | 155 main_thread_task_runner_); |
| 161 FactoryImpl::AddFactory<ash::mojom::WallpaperManager>( | |
| 162 registry, main_thread_task_runner_); | |
| 163 FactoryImpl::AddFactory<app_list::mojom::AppListPresenter>( | 156 FactoryImpl::AddFactory<app_list::mojom::AppListPresenter>( |
| 164 registry, main_thread_task_runner_); | 157 registry, main_thread_task_runner_); |
| 165 | 158 |
| 166 // In classic ash, the browser process provides ash services to itself. | 159 // In classic ash, the browser process provides ash services to itself. |
| 167 if (!chrome::IsRunningInMash()) { | 160 if (!chrome::IsRunningInMash()) { |
| 168 ash::mojo_interface_factory::RegisterInterfaces(registry, | 161 ash::mojo_interface_factory::RegisterInterfaces(registry, |
| 169 main_thread_task_runner_); | 162 main_thread_task_runner_); |
| 170 } | 163 } |
| 171 | 164 |
| 172 return true; | 165 return true; |
| 173 } | 166 } |
| 174 | 167 |
| 175 } // namespace chromeos | 168 } // namespace chromeos |
| OLD | NEW |