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 | 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/shell/public/cpp/connection.h" | 26 #include "services/shell/public/cpp/connection.h" |
28 #include "services/shell/public/cpp/interface_registry.h" | 27 #include "services/shell/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 Loading... | |
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 chromeos::WallpaperManager::Get()->BindRequest(std::move(request)); |
James Cook
2016/10/11 23:21:49
nit: chromeos:: not needed?
msw
2016/10/14 21:07:43
Done.
| |
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 21 matching lines...) Expand all Loading... | |
175 // In classic ash, the browser process provides ash services to itself. | 171 // In classic ash, the browser process provides ash services to itself. |
176 if (!chrome::IsRunningInMash()) { | 172 if (!chrome::IsRunningInMash()) { |
177 ash::mojo_interface_factory::RegisterInterfaces(registry, | 173 ash::mojo_interface_factory::RegisterInterfaces(registry, |
178 main_thread_task_runner_); | 174 main_thread_task_runner_); |
179 } | 175 } |
180 | 176 |
181 return true; | 177 return true; |
182 } | 178 } |
183 | 179 |
184 } // namespace chromeos | 180 } // namespace chromeos |
OLD | NEW |