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 <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "ash/desktop_background/desktop_background_controller.h" | 12 #include "ash/desktop_background/desktop_background_controller.h" |
13 #include "ash/host/ash_window_tree_host_init_params.h" | 13 #include "ash/host/ash_window_tree_host_init_params.h" |
14 #include "ash/host/ash_window_tree_host_platform.h" | 14 #include "ash/host/ash_window_tree_host_platform.h" |
15 #include "ash/mus/app_list_presenter_mus.h" | 15 #include "ash/mus/app_list_presenter_mus.h" |
16 #include "ash/mus/keyboard_ui_mus.h" | 16 #include "ash/mus/keyboard_ui_mus.h" |
17 #include "ash/mus/shelf_delegate_mus.h" | 17 #include "ash/mus/shelf_delegate_mus.h" |
18 #include "ash/mus/shell_delegate_mus.h" | 18 #include "ash/mus/shell_delegate_mus.h" |
19 #include "ash/mus/stub_context_factory.h" | 19 #include "ash/mus/stub_context_factory.h" |
20 #include "ash/root_window_settings.h" | 20 #include "ash/root_window_settings.h" |
21 #include "ash/shell.h" | 21 #include "ash/shell.h" |
22 #include "ash/shell_init_params.h" | 22 #include "ash/shell_init_params.h" |
23 #include "ash/shell_window_ids.h" | 23 #include "ash/shell_window_ids.h" |
24 #include "base/bind.h" | 24 #include "base/bind.h" |
25 #include "base/files/file_path.h" | 25 #include "base/files/file_path.h" |
26 #include "base/path_service.h" | 26 #include "base/path_service.h" |
27 #include "base/threading/sequenced_worker_pool.h" | 27 #include "base/threading/sequenced_worker_pool.h" |
28 #include "components/mus/public/cpp/property_type_converters.h" | 28 #include "components/mus/public/cpp/property_type_converters.h" |
29 #include "components/resource_provider/public/cpp/resource_loader.h" | |
30 #include "mash/wm/public/interfaces/ash_window_type.mojom.h" | 29 #include "mash/wm/public/interfaces/ash_window_type.mojom.h" |
31 #include "mash/wm/public/interfaces/container.mojom.h" | 30 #include "mash/wm/public/interfaces/container.mojom.h" |
| 31 #include "services/catalog/public/cpp/resource_loader.h" |
| 32 #include "services/shell/public/cpp/connector.h" |
32 #include "ui/aura/env.h" | 33 #include "ui/aura/env.h" |
33 #include "ui/base/resource/resource_bundle.h" | 34 #include "ui/base/resource/resource_bundle.h" |
34 #include "ui/base/ui_base_paths.h" | 35 #include "ui/base/ui_base_paths.h" |
35 #include "ui/message_center/message_center.h" | 36 #include "ui/message_center/message_center.h" |
36 #include "ui/platform_window/stub/stub_window.h" | 37 #include "ui/platform_window/stub/stub_window.h" |
37 #include "ui/views/mus/aura_init.h" | 38 #include "ui/views/mus/aura_init.h" |
38 #include "ui/views/mus/native_widget_mus.h" | 39 #include "ui/views/mus/native_widget_mus.h" |
39 #include "ui/views/mus/window_manager_connection.h" | 40 #include "ui/views/mus/window_manager_connection.h" |
40 #include "ui/views/views_delegate.h" | 41 #include "ui/views/views_delegate.h" |
41 | 42 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 241 |
241 void InitializeResourceBundle(::shell::Connector* connector) { | 242 void InitializeResourceBundle(::shell::Connector* connector) { |
242 if (ui::ResourceBundle::HasSharedInstance()) | 243 if (ui::ResourceBundle::HasSharedInstance()) |
243 return; | 244 return; |
244 | 245 |
245 std::set<std::string> resource_paths; | 246 std::set<std::string> resource_paths; |
246 resource_paths.insert(kResourceFileStrings); | 247 resource_paths.insert(kResourceFileStrings); |
247 resource_paths.insert(kResourceFile100); | 248 resource_paths.insert(kResourceFile100); |
248 resource_paths.insert(kResourceFile200); | 249 resource_paths.insert(kResourceFile200); |
249 | 250 |
250 resource_provider::ResourceLoader loader(connector, resource_paths); | 251 catalog::ResourceLoader loader; |
251 if (!loader.BlockUntilLoaded()) | 252 filesystem::DirectoryPtr directory; |
252 return; | 253 connector->ConnectToInterface("mojo:catalog", &directory); |
| 254 CHECK(loader.OpenFiles(std::move(directory), resource_paths)); |
253 | 255 |
254 // Load ash resources and en-US strings; not 'common' (Chrome) resources. | 256 // Load ash resources and en-US strings; not 'common' (Chrome) resources. |
255 // TODO(msw): Check ResourceBundle::IsScaleFactorSupported; load 300% etc. | 257 // TODO(msw): Check ResourceBundle::IsScaleFactorSupported; load 300% etc. |
256 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( | 258 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( |
257 loader.ReleaseFile(kResourceFileStrings), | 259 loader.TakeFile(kResourceFileStrings), |
258 base::MemoryMappedFile::Region::kWholeFile); | 260 base::MemoryMappedFile::Region::kWholeFile); |
259 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 261 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
260 rb.AddDataPackFromFile(loader.ReleaseFile(kResourceFile100), | 262 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile100), |
261 ui::SCALE_FACTOR_100P); | 263 ui::SCALE_FACTOR_100P); |
262 rb.AddDataPackFromFile(loader.ReleaseFile(kResourceFile200), | 264 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile200), |
263 ui::SCALE_FACTOR_200P); | 265 ui::SCALE_FACTOR_200P); |
264 } | 266 } |
265 | 267 |
266 void SetupWallpaper(SkColor color) { | 268 void SetupWallpaper(SkColor color) { |
267 SkBitmap bitmap; | 269 SkBitmap bitmap; |
268 bitmap.allocN32Pixels(16, 16); | 270 bitmap.allocN32Pixels(16, 16); |
269 bitmap.eraseColor(color); | 271 bitmap.eraseColor(color); |
270 #if !defined(NDEBUG) | 272 #if !defined(NDEBUG) |
271 // In debug builds we generate a simple pattern that allows visually | 273 // In debug builds we generate a simple pattern that allows visually |
272 // notice if transparency is broken. | 274 // notice if transparency is broken. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 void SysUIApplication::Create( | 325 void SysUIApplication::Create( |
324 ::shell::Connection* connection, | 326 ::shell::Connection* connection, |
325 mojo::InterfaceRequest<mash::shelf::mojom::ShelfController> request) { | 327 mojo::InterfaceRequest<mash::shelf::mojom::ShelfController> request) { |
326 mash::shelf::mojom::ShelfController* shelf_controller = | 328 mash::shelf::mojom::ShelfController* shelf_controller = |
327 static_cast<ShelfDelegateMus*>(Shell::GetInstance()->GetShelfDelegate()); | 329 static_cast<ShelfDelegateMus*>(Shell::GetInstance()->GetShelfDelegate()); |
328 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); | 330 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); |
329 } | 331 } |
330 | 332 |
331 } // namespace sysui | 333 } // namespace sysui |
332 } // namespace ash | 334 } // namespace ash |
OLD | NEW |