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

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

Issue 2413503002: Cleanup mojo Wallpaper interfaces for mash. (Closed)
Patch Set: Sync and rebase again... Created 4 years, 2 months 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 8
9 #include "ash/common/mojo_interface_factory.h" 9 #include "ash/common/mojo_interface_factory.h"
10 #include "ash/public/interfaces/wallpaper.mojom.h"
11 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
12 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
13 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
14 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_manager.h" 16 #include "chrome/browser/profiles/profile_manager.h"
17 #include "chrome/browser/ui/ash/app_list/app_list_presenter_service.h" 17 #include "chrome/browser/ui/ash/app_list/app_list_presenter_service.h"
18 #include "chrome/browser/ui/ash/ash_util.h" 18 #include "chrome/browser/ui/ash/ash_util.h"
19 #include "chrome/browser/ui/ash/chrome_wallpaper_manager.h"
20 #include "chrome/browser/ui/ash/keyboard_ui_service.h" 19 #include "chrome/browser/ui/ash/keyboard_ui_service.h"
21 #include "chrome/browser/ui/ash/system_tray_client.h" 20 #include "chrome/browser/ui/ash/system_tray_client.h"
22 #include "chrome/browser/ui/browser_commands.h" 21 #include "chrome/browser/ui/browser_commands.h"
23 #include "chrome/browser/ui/browser_finder.h" 22 #include "chrome/browser/ui/browser_finder.h"
24 #include "content/public/common/service_manager_connection.h" 23 #include "content/public/common/service_manager_connection.h"
25 #include "mash/public/interfaces/launchable.mojom.h" 24 #include "mash/public/interfaces/launchable.mojom.h"
26 #include "mojo/public/cpp/bindings/binding_set.h" 25 #include "mojo/public/cpp/bindings/binding_set.h"
27 #include "services/service_manager/public/cpp/connection.h" 26 #include "services/service_manager/public/cpp/connection.h"
28 #include "services/service_manager/public/cpp/interface_registry.h" 27 #include "services/service_manager/public/cpp/interface_registry.h"
29 #include "ui/app_list/presenter/app_list_presenter.mojom.h" 28 #include "ui/app_list/presenter/app_list_presenter.mojom.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 launchable_.reset(new ChromeLaunchable); 114 launchable_.reset(new ChromeLaunchable);
116 launchable_->ProcessRequest(std::move(request)); 115 launchable_->ProcessRequest(std::move(request));
117 } 116 }
118 117
119 void BindRequest(ash::mojom::SystemTrayClientRequest request) { 118 void BindRequest(ash::mojom::SystemTrayClientRequest request) {
120 system_tray_client_bindings_.AddBinding(SystemTrayClient::Get(), 119 system_tray_client_bindings_.AddBinding(SystemTrayClient::Get(),
121 std::move(request)); 120 std::move(request));
122 } 121 }
123 122
124 void BindRequest(ash::mojom::WallpaperManagerRequest request) { 123 void BindRequest(ash::mojom::WallpaperManagerRequest request) {
125 if (!wallpaper_manager_) 124 WallpaperManager::Get()->BindRequest(std::move(request));
126 wallpaper_manager_.reset(new ChromeWallpaperManager);
127 wallpaper_manager_->ProcessRequest(std::move(request));
128 } 125 }
129 126
130 void BindRequest(app_list::mojom::AppListPresenterRequest request) { 127 void BindRequest(app_list::mojom::AppListPresenterRequest request) {
131 if (!app_list_presenter_service_) 128 if (!app_list_presenter_service_)
132 app_list_presenter_service_.reset(new AppListPresenterService); 129 app_list_presenter_service_.reset(new AppListPresenterService);
133 app_list_presenter_bindings_.AddBinding(app_list_presenter_service_.get(), 130 app_list_presenter_bindings_.AddBinding(app_list_presenter_service_.get(),
134 std::move(request)); 131 std::move(request));
135 } 132 }
136 133
137 static base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky factory_; 134 static base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky factory_;
138 135
139 std::unique_ptr<KeyboardUIService> keyboard_ui_service_; 136 std::unique_ptr<KeyboardUIService> keyboard_ui_service_;
140 mojo::BindingSet<keyboard::mojom::Keyboard> keyboard_bindings_; 137 mojo::BindingSet<keyboard::mojom::Keyboard> keyboard_bindings_;
141 std::unique_ptr<ChromeLaunchable> launchable_; 138 std::unique_ptr<ChromeLaunchable> launchable_;
142 mojo::BindingSet<ash::mojom::SystemTrayClient> system_tray_client_bindings_; 139 mojo::BindingSet<ash::mojom::SystemTrayClient> system_tray_client_bindings_;
143 std::unique_ptr<ChromeWallpaperManager> wallpaper_manager_;
144 std::unique_ptr<AppListPresenterService> app_list_presenter_service_; 140 std::unique_ptr<AppListPresenterService> app_list_presenter_service_;
145 mojo::BindingSet<app_list::mojom::AppListPresenter> 141 mojo::BindingSet<app_list::mojom::AppListPresenter>
146 app_list_presenter_bindings_; 142 app_list_presenter_bindings_;
147 143
148 DISALLOW_COPY_AND_ASSIGN(FactoryImpl); 144 DISALLOW_COPY_AND_ASSIGN(FactoryImpl);
149 }; 145 };
150 146
151 base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky FactoryImpl::factory_ = 147 base::LazyInstance<std::unique_ptr<FactoryImpl>>::Leaky FactoryImpl::factory_ =
152 LAZY_INSTANCE_INITIALIZER; 148 LAZY_INSTANCE_INITIALIZER;
153 149
(...skipping 22 matching lines...) Expand all
176 // In classic ash, the browser process provides ash services to itself. 172 // In classic ash, the browser process provides ash services to itself.
177 if (!chrome::IsRunningInMash()) { 173 if (!chrome::IsRunningInMash()) {
178 ash::mojo_interface_factory::RegisterInterfaces(registry, 174 ash::mojo_interface_factory::RegisterInterfaces(registry,
179 main_thread_task_runner_); 175 main_thread_task_runner_);
180 } 176 }
181 177
182 return true; 178 return true;
183 } 179 }
184 180
185 } // namespace chromeos 181 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698