Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: chrome/browser/chromeos/chrome_interface_factory.cc

Issue 2471643002: mash: remove the LockStateControllerDelegate. (Closed)
Patch Set: sky comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 9
9 #include "ash/common/mojo_interface_factory.h" 10 #include "ash/common/mojo_interface_factory.h"
10 #include "ash/public/interfaces/new_window.mojom.h" 11 #include "ash/public/interfaces/new_window.mojom.h"
12 #include "ash/public/interfaces/shutdown.mojom.h"
11 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
12 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
13 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
14 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
15 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
16 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 18 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
19 #include "chrome/browser/chromeos/power/shutdown_client_impl.h"
17 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/browser/ui/ash/app_list/app_list_presenter_service.h" 22 #include "chrome/browser/ui/ash/app_list/app_list_presenter_service.h"
20 #include "chrome/browser/ui/ash/ash_util.h" 23 #include "chrome/browser/ui/ash/ash_util.h"
21 #include "chrome/browser/ui/ash/chrome_new_window_client.h" 24 #include "chrome/browser/ui/ash/chrome_new_window_client.h"
22 #include "chrome/browser/ui/ash/keyboard_ui_service.h" 25 #include "chrome/browser/ui/ash/keyboard_ui_service.h"
23 #include "chrome/browser/ui/ash/system_tray_client.h" 26 #include "chrome/browser/ui/ash/system_tray_client.h"
24 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" 27 #include "chrome/browser/ui/ash/volume_controller_chromeos.h"
25 #include "chrome/browser/ui/browser_commands.h" 28 #include "chrome/browser/ui/browser_commands.h"
26 #include "chrome/browser/ui/browser_finder.h" 29 #include "chrome/browser/ui/browser_finder.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 launchable_->ProcessRequest(std::move(request)); 119 launchable_->ProcessRequest(std::move(request));
117 } 120 }
118 121
119 void BindRequest(ash::mojom::NewWindowClientRequest request) { 122 void BindRequest(ash::mojom::NewWindowClientRequest request) {
120 if (!new_window_client_) 123 if (!new_window_client_)
121 new_window_client_.reset(new ChromeNewWindowClient); 124 new_window_client_.reset(new ChromeNewWindowClient);
122 new_window_client_bindings_.AddBinding(new_window_client_.get(), 125 new_window_client_bindings_.AddBinding(new_window_client_.get(),
123 std::move(request)); 126 std::move(request));
124 } 127 }
125 128
129 void BindRequest(ash::mojom::ShutdownClientRequest request) {
130 if (!shutdown_client_)
131 shutdown_client_ = base::MakeUnique<ShutdownClientImpl>();
132 shutdown_client_bindings_.AddBinding(shutdown_client_.get(),
133 std::move(request));
134 }
135
126 void BindRequest(ash::mojom::SystemTrayClientRequest request) { 136 void BindRequest(ash::mojom::SystemTrayClientRequest request) {
127 system_tray_client_bindings_.AddBinding(SystemTrayClient::Get(), 137 system_tray_client_bindings_.AddBinding(SystemTrayClient::Get(),
128 std::move(request)); 138 std::move(request));
129 } 139 }
130 140
131 void BindRequest(ash::mojom::WallpaperManagerRequest request) { 141 void BindRequest(ash::mojom::WallpaperManagerRequest request) {
132 WallpaperManager::Get()->BindRequest(std::move(request)); 142 WallpaperManager::Get()->BindRequest(std::move(request));
133 } 143 }
134 144
135 void BindRequest(ash::mojom::VolumeControllerRequest request) { 145 void BindRequest(ash::mojom::VolumeControllerRequest request) {
136 if (!volume_controller_) 146 if (!volume_controller_)
137 volume_controller_ = base::MakeUnique<VolumeController>(); 147 volume_controller_ = base::MakeUnique<VolumeController>();
138 volume_controller_->BindRequest(std::move(request)); 148 volume_controller_->BindRequest(std::move(request));
139 } 149 }
140 150
141 void BindRequest(app_list::mojom::AppListPresenterRequest request) { 151 void BindRequest(app_list::mojom::AppListPresenterRequest request) {
142 if (!app_list_presenter_service_) 152 if (!app_list_presenter_service_)
143 app_list_presenter_service_ = base::MakeUnique<AppListPresenterService>(); 153 app_list_presenter_service_ = base::MakeUnique<AppListPresenterService>();
144 app_list_presenter_bindings_.AddBinding(app_list_presenter_service_.get(), 154 app_list_presenter_bindings_.AddBinding(app_list_presenter_service_.get(),
145 std::move(request)); 155 std::move(request));
146 } 156 }
147 157
148 static base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky factory_; 158 static base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky factory_;
149 159
150 std::unique_ptr<KeyboardUIService> keyboard_ui_service_; 160 std::unique_ptr<KeyboardUIService> keyboard_ui_service_;
151 mojo::BindingSet<keyboard::mojom::Keyboard> keyboard_bindings_; 161 mojo::BindingSet<keyboard::mojom::Keyboard> keyboard_bindings_;
152 std::unique_ptr<ChromeLaunchable> launchable_; 162 std::unique_ptr<ChromeLaunchable> launchable_;
153 std::unique_ptr<ChromeNewWindowClient> new_window_client_; 163 std::unique_ptr<ChromeNewWindowClient> new_window_client_;
154 mojo::BindingSet<ash::mojom::NewWindowClient> new_window_client_bindings_; 164 mojo::BindingSet<ash::mojom::NewWindowClient> new_window_client_bindings_;
165 std::unique_ptr<ShutdownClientImpl> shutdown_client_;
166 mojo::BindingSet<ash::mojom::ShutdownClient> shutdown_client_bindings_;
155 mojo::BindingSet<ash::mojom::SystemTrayClient> system_tray_client_bindings_; 167 mojo::BindingSet<ash::mojom::SystemTrayClient> system_tray_client_bindings_;
156 std::unique_ptr<VolumeController> volume_controller_; 168 std::unique_ptr<VolumeController> volume_controller_;
157 std::unique_ptr<AppListPresenterService> app_list_presenter_service_; 169 std::unique_ptr<AppListPresenterService> app_list_presenter_service_;
158 mojo::BindingSet<app_list::mojom::AppListPresenter> 170 mojo::BindingSet<app_list::mojom::AppListPresenter>
159 app_list_presenter_bindings_; 171 app_list_presenter_bindings_;
160 172
161 DISALLOW_COPY_AND_ASSIGN(FactoryImpl); 173 DISALLOW_COPY_AND_ASSIGN(FactoryImpl);
162 }; 174 };
163 175
164 base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky FactoryImpl::factory_ = 176 base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky FactoryImpl::factory_ =
165 LAZY_INSTANCE_INITIALIZER; 177 LAZY_INSTANCE_INITIALIZER;
166 178
167 } // namespace 179 } // namespace
168 180
169 ChromeInterfaceFactory::ChromeInterfaceFactory() 181 ChromeInterfaceFactory::ChromeInterfaceFactory()
170 : main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) {} 182 : main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
171 183
172 ChromeInterfaceFactory::~ChromeInterfaceFactory() {} 184 ChromeInterfaceFactory::~ChromeInterfaceFactory() {}
173 185
174 bool ChromeInterfaceFactory::OnConnect( 186 bool ChromeInterfaceFactory::OnConnect(
175 const service_manager::Identity& remote_identity, 187 const service_manager::Identity& remote_identity,
176 service_manager::InterfaceRegistry* registry, 188 service_manager::InterfaceRegistry* registry,
177 service_manager::Connector* connector) { 189 service_manager::Connector* connector) {
178 FactoryImpl::AddFactory<keyboard::mojom::Keyboard>(registry, 190 FactoryImpl::AddFactory<keyboard::mojom::Keyboard>(registry,
179 main_thread_task_runner_); 191 main_thread_task_runner_);
180 FactoryImpl::AddFactory<mash::mojom::Launchable>(registry, 192 FactoryImpl::AddFactory<mash::mojom::Launchable>(registry,
181 main_thread_task_runner_); 193 main_thread_task_runner_);
182 FactoryImpl::AddFactory<ash::mojom::NewWindowClient>( 194 FactoryImpl::AddFactory<ash::mojom::NewWindowClient>(
183 registry, main_thread_task_runner_); 195 registry, main_thread_task_runner_);
196 FactoryImpl::AddFactory<ash::mojom::ShutdownClient>(registry,
197 main_thread_task_runner_);
184 FactoryImpl::AddFactory<ash::mojom::SystemTrayClient>( 198 FactoryImpl::AddFactory<ash::mojom::SystemTrayClient>(
185 registry, main_thread_task_runner_); 199 registry, main_thread_task_runner_);
186 FactoryImpl::AddFactory<ash::mojom::VolumeController>( 200 FactoryImpl::AddFactory<ash::mojom::VolumeController>(
187 registry, main_thread_task_runner_); 201 registry, main_thread_task_runner_);
188 FactoryImpl::AddFactory<ash::mojom::WallpaperManager>( 202 FactoryImpl::AddFactory<ash::mojom::WallpaperManager>(
189 registry, main_thread_task_runner_); 203 registry, main_thread_task_runner_);
190 FactoryImpl::AddFactory<app_list::mojom::AppListPresenter>( 204 FactoryImpl::AddFactory<app_list::mojom::AppListPresenter>(
191 registry, main_thread_task_runner_); 205 registry, main_thread_task_runner_);
192 206
193 // In classic ash, the browser process provides ash services to itself. 207 // In classic ash, the browser process provides ash services to itself.
194 if (!chrome::IsRunningInMash()) { 208 if (!chrome::IsRunningInMash()) {
195 ash::mojo_interface_factory::RegisterInterfaces(registry, 209 ash::mojo_interface_factory::RegisterInterfaces(registry,
196 main_thread_task_runner_); 210 main_thread_task_runner_);
197 } 211 }
198 212
199 return true; 213 return true;
200 } 214 }
201 215
202 } // namespace chromeos 216 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/BUILD.gn ('k') | chrome/browser/chromeos/power/login_lock_state_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698