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