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 "ash/mus/sysui_application.h" | 5 #include "ash/mus/sysui_application.h" |
6 | 6 |
7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
8 #include "ash/host/ash_window_tree_host_init_params.h" | 8 #include "ash/host/ash_window_tree_host_init_params.h" |
9 #include "ash/host/ash_window_tree_host_platform.h" | 9 #include "ash/host/ash_window_tree_host_platform.h" |
10 #include "ash/mus/shell_delegate_mus.h" | 10 #include "ash/mus/shell_delegate_mus.h" |
11 #include "ash/mus/stub_context_factory.h" | 11 #include "ash/mus/stub_context_factory.h" |
12 #include "ash/root_window_settings.h" | 12 #include "ash/root_window_settings.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "ash/shell_init_params.h" | 14 #include "ash/shell_init_params.h" |
15 #include "ash/shell_window_ids.h" | 15 #include "ash/shell_window_ids.h" |
16 #include "base/threading/sequenced_worker_pool.h" | 16 #include "base/threading/sequenced_worker_pool.h" |
17 #include "components/mus/public/cpp/property_type_converters.h" | 17 #include "components/mus/public/cpp/property_type_converters.h" |
18 #include "mash/wm/public/interfaces/container.mojom.h" | 18 #include "mash/wm/public/interfaces/container.mojom.h" |
19 #include "ui/aura/env.h" | 19 #include "ui/aura/env.h" |
20 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
21 #include "ui/base/ui_base_paths.h" | 21 #include "ui/base/ui_base_paths.h" |
22 #include "ui/message_center/message_center.h" | 22 #include "ui/message_center/message_center.h" |
23 #include "ui/platform_window/stub/stub_window.h" | 23 #include "ui/platform_window/stub/stub_window.h" |
24 #include "ui/views/mus/aura_init.h" | 24 #include "ui/views/mus/aura_init.h" |
25 #include "ui/views/mus/native_widget_mus.h" | 25 #include "ui/views/mus/native_widget_mus.h" |
26 #include "ui/views/mus/window_manager_connection.h" | 26 #include "ui/views/mus/window_manager_connection.h" |
27 #include "ui/views/views_delegate.h" | 27 #include "ui/views/views_delegate.h" |
28 | 28 |
| 29 #if defined(OS_CHROMEOS) |
| 30 #include "chromeos/audio/cras_audio_handler.h" |
| 31 #include "chromeos/dbus/dbus_thread_manager.h" |
| 32 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 33 #include "ui/events/devices/device_data_manager.h" |
| 34 #endif |
| 35 |
29 using views::ViewsDelegate; | 36 using views::ViewsDelegate; |
30 | 37 |
31 namespace ash { | 38 namespace ash { |
32 namespace sysui { | 39 namespace sysui { |
33 | 40 |
34 namespace { | 41 namespace { |
35 | 42 |
36 // Tries to determine the corresponding container in mash from the ash container | 43 // Tries to determine the corresponding container in mash from the ash container |
37 // for the widget. | 44 // for the widget. |
38 mash::wm::mojom::Container GetContainerId(aura::Window* container) { | 45 mash::wm::mojom::Container GetContainerId(aura::Window* container) { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // installs and uses the ScreenAsh. This can be removed once ash learns to | 161 // installs and uses the ScreenAsh. This can be removed once ash learns to |
155 // talk to mus for managing displays. | 162 // talk to mus for managing displays. |
156 gfx::Screen::SetScreenInstance(nullptr); | 163 gfx::Screen::SetScreenInstance(nullptr); |
157 | 164 |
158 // Install some hook so that the WindowTreeHostMus created for widgets can | 165 // Install some hook so that the WindowTreeHostMus created for widgets can |
159 // be hooked up correctly. | 166 // be hooked up correctly. |
160 native_widget_factory_.reset(new NativeWidgetFactory()); | 167 native_widget_factory_.reset(new NativeWidgetFactory()); |
161 | 168 |
162 ash::AshWindowTreeHost::SetFactory(base::Bind(&CreateWindowTreeHostMus)); | 169 ash::AshWindowTreeHost::SetFactory(base::Bind(&CreateWindowTreeHostMus)); |
163 ash_delegate_ = new ShellDelegateMus; | 170 ash_delegate_ = new ShellDelegateMus; |
164 message_center::MessageCenter::Initialize(); | 171 |
| 172 InitializeComponents(); |
165 | 173 |
166 ash::ShellInitParams init_params; | 174 ash::ShellInitParams init_params; |
167 init_params.delegate = ash_delegate_; | 175 init_params.delegate = ash_delegate_; |
168 init_params.context_factory = new StubContextFactory; | 176 init_params.context_factory = new StubContextFactory; |
169 init_params.blocking_pool = worker_pool_.get(); | 177 init_params.blocking_pool = worker_pool_.get(); |
170 ash::Shell::CreateInstance(init_params); | 178 ash::Shell::CreateInstance(init_params); |
171 ash::Shell::GetInstance()->CreateShelf(); | 179 ash::Shell::GetInstance()->CreateShelf(); |
172 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( | 180 ash::Shell::GetInstance()->UpdateAfterLoginStatusChange( |
173 ash::user::LOGGED_IN_USER); | 181 ash::user::LOGGED_IN_USER); |
174 | 182 |
(...skipping 12 matching lines...) Expand all Loading... |
187 SkAutoLockPixels alp(bitmap); | 195 SkAutoLockPixels alp(bitmap); |
188 *bitmap.getAddr32(0, 0) = SkColorSetRGB(0, 0, 0); | 196 *bitmap.getAddr32(0, 0) = SkColorSetRGB(0, 0, 0); |
189 } | 197 } |
190 #endif | 198 #endif |
191 gfx::ImageSkia wallpaper = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); | 199 gfx::ImageSkia wallpaper = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
192 ash::Shell::GetInstance() | 200 ash::Shell::GetInstance() |
193 ->desktop_background_controller() | 201 ->desktop_background_controller() |
194 ->SetWallpaperImage(wallpaper, wallpaper::WALLPAPER_LAYOUT_TILE); | 202 ->SetWallpaperImage(wallpaper, wallpaper::WALLPAPER_LAYOUT_TILE); |
195 } | 203 } |
196 | 204 |
| 205 void InitializeComponents() { |
| 206 message_center::MessageCenter::Initialize(); |
| 207 |
| 208 #if defined(OS_CHROMEOS) |
| 209 ui::DeviceDataManager::CreateInstance(); |
| 210 chromeos::DBusThreadManager::Initialize(); |
| 211 bluez::BluezDBusManager::Initialize( |
| 212 chromeos::DBusThreadManager::Get()->GetSystemBus(), |
| 213 chromeos::DBusThreadManager::Get()->IsUsingStub( |
| 214 chromeos::DBusClientBundle::BLUETOOTH)); |
| 215 chromeos::CrasAudioHandler::InitializeForTesting(); |
| 216 #endif |
| 217 } |
| 218 |
197 private: | 219 private: |
198 scoped_refptr<base::SequencedWorkerPool> worker_pool_; | 220 scoped_refptr<base::SequencedWorkerPool> worker_pool_; |
199 scoped_ptr<views::AuraInit> aura_init_; | 221 scoped_ptr<views::AuraInit> aura_init_; |
200 ShellDelegateMus* ash_delegate_ = nullptr; | 222 ShellDelegateMus* ash_delegate_ = nullptr; |
201 scoped_ptr<NativeWidgetFactory> native_widget_factory_; | 223 scoped_ptr<NativeWidgetFactory> native_widget_factory_; |
202 | 224 |
203 DISALLOW_COPY_AND_ASSIGN(AshInit); | 225 DISALLOW_COPY_AND_ASSIGN(AshInit); |
204 }; | 226 }; |
205 | 227 |
206 SysUIApplication::SysUIApplication() {} | 228 SysUIApplication::SysUIApplication() {} |
207 | 229 |
208 SysUIApplication::~SysUIApplication() {} | 230 SysUIApplication::~SysUIApplication() {} |
209 | 231 |
210 void SysUIApplication::Initialize(mojo::Shell* shell, | 232 void SysUIApplication::Initialize(mojo::Shell* shell, |
211 const std::string& url, | 233 const std::string& url, |
212 uint32_t id) { | 234 uint32_t id) { |
213 ash_init_.reset(new AshInit()); | 235 ash_init_.reset(new AshInit()); |
214 ash_init_->Initialize(shell); | 236 ash_init_->Initialize(shell); |
215 } | 237 } |
216 | 238 |
217 } // namespace sysui | 239 } // namespace sysui |
218 } // namespace ash | 240 } // namespace ash |
OLD | NEW |