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

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

Issue 2552483002: mash: Have chrome set itself as a controller interface for changing volume (Closed)
Patch Set: comment 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
« no previous file with comments | « chrome/browser/chrome_content_browser_manifest_overlay.json ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/volume_controller_chromeos.h"
26 #include "chrome/browser/ui/browser_commands.h" 25 #include "chrome/browser/ui/browser_commands.h"
27 #include "chrome/browser/ui/browser_finder.h" 26 #include "chrome/browser/ui/browser_finder.h"
28 #include "content/public/common/service_manager_connection.h" 27 #include "content/public/common/service_manager_connection.h"
29 #include "mash/public/interfaces/launchable.mojom.h" 28 #include "mash/public/interfaces/launchable.mojom.h"
30 #include "mojo/public/cpp/bindings/binding_set.h" 29 #include "mojo/public/cpp/bindings/binding_set.h"
31 #include "services/service_manager/public/cpp/connection.h" 30 #include "services/service_manager/public/cpp/connection.h"
32 #include "services/service_manager/public/cpp/interface_registry.h" 31 #include "services/service_manager/public/cpp/interface_registry.h"
33 #include "ui/app_list/presenter/app_list_presenter.mojom.h" 32 #include "ui/app_list/presenter/app_list_presenter.mojom.h"
34 #include "ui/keyboard/keyboard.mojom.h" 33 #include "ui/keyboard/keyboard.mojom.h"
35 34
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if (!new_window_client_) 120 if (!new_window_client_)
122 new_window_client_.reset(new ChromeNewWindowClient); 121 new_window_client_.reset(new ChromeNewWindowClient);
123 new_window_client_bindings_.AddBinding(new_window_client_.get(), 122 new_window_client_bindings_.AddBinding(new_window_client_.get(),
124 std::move(request)); 123 std::move(request));
125 } 124 }
126 125
127 void BindRequest(ash::mojom::WallpaperManagerRequest request) { 126 void BindRequest(ash::mojom::WallpaperManagerRequest request) {
128 WallpaperManager::Get()->BindRequest(std::move(request)); 127 WallpaperManager::Get()->BindRequest(std::move(request));
129 } 128 }
130 129
131 void BindRequest(ash::mojom::VolumeControllerRequest request) {
132 if (!volume_controller_)
133 volume_controller_ = base::MakeUnique<VolumeController>();
134 volume_controller_->BindRequest(std::move(request));
135 }
136
137 void BindRequest(app_list::mojom::AppListPresenterRequest request) { 130 void BindRequest(app_list::mojom::AppListPresenterRequest request) {
138 if (!app_list_presenter_service_) 131 if (!app_list_presenter_service_)
139 app_list_presenter_service_ = base::MakeUnique<AppListPresenterService>(); 132 app_list_presenter_service_ = base::MakeUnique<AppListPresenterService>();
140 app_list_presenter_bindings_.AddBinding(app_list_presenter_service_.get(), 133 app_list_presenter_bindings_.AddBinding(app_list_presenter_service_.get(),
141 std::move(request)); 134 std::move(request));
142 } 135 }
143 136
144 static base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky factory_; 137 static base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky factory_;
145 138
146 std::unique_ptr<KeyboardUIService> keyboard_ui_service_; 139 std::unique_ptr<KeyboardUIService> keyboard_ui_service_;
147 mojo::BindingSet<keyboard::mojom::Keyboard> keyboard_bindings_; 140 mojo::BindingSet<keyboard::mojom::Keyboard> keyboard_bindings_;
148 std::unique_ptr<ChromeLaunchable> launchable_; 141 std::unique_ptr<ChromeLaunchable> launchable_;
149 std::unique_ptr<ChromeNewWindowClient> new_window_client_; 142 std::unique_ptr<ChromeNewWindowClient> new_window_client_;
150 mojo::BindingSet<ash::mojom::NewWindowClient> new_window_client_bindings_; 143 mojo::BindingSet<ash::mojom::NewWindowClient> new_window_client_bindings_;
151 std::unique_ptr<VolumeController> volume_controller_;
152 std::unique_ptr<AppListPresenterService> app_list_presenter_service_; 144 std::unique_ptr<AppListPresenterService> app_list_presenter_service_;
153 mojo::BindingSet<app_list::mojom::AppListPresenter> 145 mojo::BindingSet<app_list::mojom::AppListPresenter>
154 app_list_presenter_bindings_; 146 app_list_presenter_bindings_;
155 147
156 DISALLOW_COPY_AND_ASSIGN(FactoryImpl); 148 DISALLOW_COPY_AND_ASSIGN(FactoryImpl);
157 }; 149 };
158 150
159 base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky FactoryImpl::factory_ = 151 base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky FactoryImpl::factory_ =
160 LAZY_INSTANCE_INITIALIZER; 152 LAZY_INSTANCE_INITIALIZER;
161 153
(...skipping 10 matching lines...) Expand all
172 service_manager::Connector* connector) { 164 service_manager::Connector* connector) {
173 // TODO(jamescook): Only register the interfaces needed for a particular 165 // TODO(jamescook): Only register the interfaces needed for a particular
174 // |remote_identity|. For example, a connection from service:ash needs these, 166 // |remote_identity|. For example, a connection from service:ash needs these,
175 // but a connection from service:content_gpu does not. 167 // but a connection from service:content_gpu does not.
176 FactoryImpl::AddFactory<keyboard::mojom::Keyboard>(registry, 168 FactoryImpl::AddFactory<keyboard::mojom::Keyboard>(registry,
177 main_thread_task_runner_); 169 main_thread_task_runner_);
178 FactoryImpl::AddFactory<mash::mojom::Launchable>(registry, 170 FactoryImpl::AddFactory<mash::mojom::Launchable>(registry,
179 main_thread_task_runner_); 171 main_thread_task_runner_);
180 FactoryImpl::AddFactory<ash::mojom::NewWindowClient>( 172 FactoryImpl::AddFactory<ash::mojom::NewWindowClient>(
181 registry, main_thread_task_runner_); 173 registry, main_thread_task_runner_);
182 FactoryImpl::AddFactory<ash::mojom::VolumeController>(
183 registry, main_thread_task_runner_);
184 FactoryImpl::AddFactory<ash::mojom::WallpaperManager>( 174 FactoryImpl::AddFactory<ash::mojom::WallpaperManager>(
185 registry, main_thread_task_runner_); 175 registry, main_thread_task_runner_);
186 FactoryImpl::AddFactory<app_list::mojom::AppListPresenter>( 176 FactoryImpl::AddFactory<app_list::mojom::AppListPresenter>(
187 registry, main_thread_task_runner_); 177 registry, main_thread_task_runner_);
188 178
189 // In classic ash, the browser process provides ash services to itself. 179 // In classic ash, the browser process provides ash services to itself.
190 if (!chrome::IsRunningInMash()) { 180 if (!chrome::IsRunningInMash()) {
191 ash::mojo_interface_factory::RegisterInterfaces(registry, 181 ash::mojo_interface_factory::RegisterInterfaces(registry,
192 main_thread_task_runner_); 182 main_thread_task_runner_);
193 } 183 }
194 184
195 return true; 185 return true;
196 } 186 }
197 187
198 } // namespace chromeos 188 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_manifest_overlay.json ('k') | chrome/browser/ui/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698