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

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

Issue 2525813004: chromeos: Introduce SetClient() on ash::mojom::SystemTray interface (Closed)
Patch Set: remove logging Created 4 years 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 #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/new_window.mojom.h" 11 #include "ash/public/interfaces/new_window.mojom.h"
12 #include "ash/public/interfaces/shutdown.mojom.h" 12 #include "ash/public/interfaces/shutdown.mojom.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
17 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
18 #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/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/profiles/profile_manager.h" 20 #include "chrome/browser/profiles/profile_manager.h"
21 #include "chrome/browser/ui/ash/app_list/app_list_presenter_service.h" 21 #include "chrome/browser/ui/ash/app_list/app_list_presenter_service.h"
22 #include "chrome/browser/ui/ash/ash_util.h" 22 #include "chrome/browser/ui/ash/ash_util.h"
23 #include "chrome/browser/ui/ash/chrome_new_window_client.h" 23 #include "chrome/browser/ui/ash/chrome_new_window_client.h"
24 #include "chrome/browser/ui/ash/keyboard_ui_service.h" 24 #include "chrome/browser/ui/ash/keyboard_ui_service.h"
25 #include "chrome/browser/ui/ash/system_tray_client.h"
26 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" 25 #include "chrome/browser/ui/ash/volume_controller_chromeos.h"
27 #include "chrome/browser/ui/browser_commands.h" 26 #include "chrome/browser/ui/browser_commands.h"
28 #include "chrome/browser/ui/browser_finder.h" 27 #include "chrome/browser/ui/browser_finder.h"
29 #include "content/public/common/service_manager_connection.h" 28 #include "content/public/common/service_manager_connection.h"
30 #include "mash/public/interfaces/launchable.mojom.h" 29 #include "mash/public/interfaces/launchable.mojom.h"
31 #include "mojo/public/cpp/bindings/binding_set.h" 30 #include "mojo/public/cpp/bindings/binding_set.h"
32 #include "services/service_manager/public/cpp/connection.h" 31 #include "services/service_manager/public/cpp/connection.h"
33 #include "services/service_manager/public/cpp/interface_registry.h" 32 #include "services/service_manager/public/cpp/interface_registry.h"
34 #include "ui/app_list/presenter/app_list_presenter.mojom.h" 33 #include "ui/app_list/presenter/app_list_presenter.mojom.h"
35 #include "ui/keyboard/keyboard.mojom.h" 34 #include "ui/keyboard/keyboard.mojom.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 launchable_->ProcessRequest(std::move(request)); 117 launchable_->ProcessRequest(std::move(request));
119 } 118 }
120 119
121 void BindRequest(ash::mojom::NewWindowClientRequest request) { 120 void BindRequest(ash::mojom::NewWindowClientRequest request) {
122 if (!new_window_client_) 121 if (!new_window_client_)
123 new_window_client_.reset(new ChromeNewWindowClient); 122 new_window_client_.reset(new ChromeNewWindowClient);
124 new_window_client_bindings_.AddBinding(new_window_client_.get(), 123 new_window_client_bindings_.AddBinding(new_window_client_.get(),
125 std::move(request)); 124 std::move(request));
126 } 125 }
127 126
128 void BindRequest(ash::mojom::SystemTrayClientRequest request) {
129 system_tray_client_bindings_.AddBinding(SystemTrayClient::Get(),
130 std::move(request));
131 }
132
133 void BindRequest(ash::mojom::WallpaperManagerRequest request) { 127 void BindRequest(ash::mojom::WallpaperManagerRequest request) {
134 WallpaperManager::Get()->BindRequest(std::move(request)); 128 WallpaperManager::Get()->BindRequest(std::move(request));
135 } 129 }
136 130
137 void BindRequest(ash::mojom::VolumeControllerRequest request) { 131 void BindRequest(ash::mojom::VolumeControllerRequest request) {
138 if (!volume_controller_) 132 if (!volume_controller_)
139 volume_controller_ = base::MakeUnique<VolumeController>(); 133 volume_controller_ = base::MakeUnique<VolumeController>();
140 volume_controller_->BindRequest(std::move(request)); 134 volume_controller_->BindRequest(std::move(request));
141 } 135 }
142 136
143 void BindRequest(app_list::mojom::AppListPresenterRequest request) { 137 void BindRequest(app_list::mojom::AppListPresenterRequest request) {
144 if (!app_list_presenter_service_) 138 if (!app_list_presenter_service_)
145 app_list_presenter_service_ = base::MakeUnique<AppListPresenterService>(); 139 app_list_presenter_service_ = base::MakeUnique<AppListPresenterService>();
146 app_list_presenter_bindings_.AddBinding(app_list_presenter_service_.get(), 140 app_list_presenter_bindings_.AddBinding(app_list_presenter_service_.get(),
147 std::move(request)); 141 std::move(request));
148 } 142 }
149 143
150 static base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky factory_; 144 static base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky factory_;
151 145
152 std::unique_ptr<KeyboardUIService> keyboard_ui_service_; 146 std::unique_ptr<KeyboardUIService> keyboard_ui_service_;
153 mojo::BindingSet<keyboard::mojom::Keyboard> keyboard_bindings_; 147 mojo::BindingSet<keyboard::mojom::Keyboard> keyboard_bindings_;
154 std::unique_ptr<ChromeLaunchable> launchable_; 148 std::unique_ptr<ChromeLaunchable> launchable_;
155 std::unique_ptr<ChromeNewWindowClient> new_window_client_; 149 std::unique_ptr<ChromeNewWindowClient> new_window_client_;
156 mojo::BindingSet<ash::mojom::NewWindowClient> new_window_client_bindings_; 150 mojo::BindingSet<ash::mojom::NewWindowClient> new_window_client_bindings_;
157 mojo::BindingSet<ash::mojom::SystemTrayClient> system_tray_client_bindings_;
158 std::unique_ptr<VolumeController> volume_controller_; 151 std::unique_ptr<VolumeController> volume_controller_;
159 std::unique_ptr<AppListPresenterService> app_list_presenter_service_; 152 std::unique_ptr<AppListPresenterService> app_list_presenter_service_;
160 mojo::BindingSet<app_list::mojom::AppListPresenter> 153 mojo::BindingSet<app_list::mojom::AppListPresenter>
161 app_list_presenter_bindings_; 154 app_list_presenter_bindings_;
162 155
163 DISALLOW_COPY_AND_ASSIGN(FactoryImpl); 156 DISALLOW_COPY_AND_ASSIGN(FactoryImpl);
164 }; 157 };
165 158
166 base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky FactoryImpl::factory_ = 159 base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky FactoryImpl::factory_ =
167 LAZY_INSTANCE_INITIALIZER; 160 LAZY_INSTANCE_INITIALIZER;
(...skipping 11 matching lines...) Expand all
179 service_manager::Connector* connector) { 172 service_manager::Connector* connector) {
180 // TODO(jamescook): Only register the interfaces needed for a particular 173 // TODO(jamescook): Only register the interfaces needed for a particular
181 // |remote_identity|. For example, a connection from service:ash needs these, 174 // |remote_identity|. For example, a connection from service:ash needs these,
182 // but a connection from service:content_gpu does not. 175 // but a connection from service:content_gpu does not.
183 FactoryImpl::AddFactory<keyboard::mojom::Keyboard>(registry, 176 FactoryImpl::AddFactory<keyboard::mojom::Keyboard>(registry,
184 main_thread_task_runner_); 177 main_thread_task_runner_);
185 FactoryImpl::AddFactory<mash::mojom::Launchable>(registry, 178 FactoryImpl::AddFactory<mash::mojom::Launchable>(registry,
186 main_thread_task_runner_); 179 main_thread_task_runner_);
187 FactoryImpl::AddFactory<ash::mojom::NewWindowClient>( 180 FactoryImpl::AddFactory<ash::mojom::NewWindowClient>(
188 registry, main_thread_task_runner_); 181 registry, main_thread_task_runner_);
189 FactoryImpl::AddFactory<ash::mojom::SystemTrayClient>(
190 registry, main_thread_task_runner_);
191 FactoryImpl::AddFactory<ash::mojom::VolumeController>( 182 FactoryImpl::AddFactory<ash::mojom::VolumeController>(
192 registry, main_thread_task_runner_); 183 registry, main_thread_task_runner_);
193 FactoryImpl::AddFactory<ash::mojom::WallpaperManager>( 184 FactoryImpl::AddFactory<ash::mojom::WallpaperManager>(
194 registry, main_thread_task_runner_); 185 registry, main_thread_task_runner_);
195 FactoryImpl::AddFactory<app_list::mojom::AppListPresenter>( 186 FactoryImpl::AddFactory<app_list::mojom::AppListPresenter>(
196 registry, main_thread_task_runner_); 187 registry, main_thread_task_runner_);
197 188
198 // In classic ash, the browser process provides ash services to itself. 189 // In classic ash, the browser process provides ash services to itself.
199 if (!chrome::IsRunningInMash()) { 190 if (!chrome::IsRunningInMash()) {
200 ash::mojo_interface_factory::RegisterInterfaces(registry, 191 ash::mojo_interface_factory::RegisterInterfaces(registry,
201 main_thread_task_runner_); 192 main_thread_task_runner_);
202 } 193 }
203 194
204 return true; 195 return true;
205 } 196 }
206 197
207 } // namespace chromeos 198 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_manifest_overlay.json ('k') | chrome/browser/ui/ash/system_tray_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698