| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/views/mus/aura_init.h" | 5 #include "ui/views/mus/aura_init.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // torn down, when we're in a bad state. | 71 // torn down, when we're in a bad state. |
| 72 font_loader_->Shutdown(); | 72 font_loader_->Shutdown(); |
| 73 } | 73 } |
| 74 #endif | 74 #endif |
| 75 } | 75 } |
| 76 | 76 |
| 77 void AuraInit::InitializeResources(shell::Connector* connector) { | 77 void AuraInit::InitializeResources(shell::Connector* connector) { |
| 78 if (ui::ResourceBundle::HasSharedInstance()) | 78 if (ui::ResourceBundle::HasSharedInstance()) |
| 79 return; | 79 return; |
| 80 catalog::ResourceLoader loader; | 80 catalog::ResourceLoader loader; |
| 81 filesystem::DirectoryPtr directory; | 81 filesystem::mojom::DirectoryPtr directory; |
| 82 connector->ConnectToInterface("mojo:catalog", &directory); | 82 connector->ConnectToInterface("mojo:catalog", &directory); |
| 83 CHECK(loader.OpenFiles(std::move(directory), | 83 CHECK(loader.OpenFiles(std::move(directory), |
| 84 GetResourcePaths(resource_file_))); | 84 GetResourcePaths(resource_file_))); |
| 85 ui::RegisterPathProvider(); | 85 ui::RegisterPathProvider(); |
| 86 base::File pak_file = loader.TakeFile(resource_file_); | 86 base::File pak_file = loader.TakeFile(resource_file_); |
| 87 base::File pak_file_2 = pak_file.Duplicate(); | 87 base::File pak_file_2 = pak_file.Duplicate(); |
| 88 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( | 88 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( |
| 89 std::move(pak_file), base::MemoryMappedFile::Region::kWholeFile); | 89 std::move(pak_file), base::MemoryMappedFile::Region::kWholeFile); |
| 90 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 90 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
| 91 std::move(pak_file_2), ui::SCALE_FACTOR_100P); | 91 std::move(pak_file_2), ui::SCALE_FACTOR_100P); |
| 92 | 92 |
| 93 // Initialize the skia font code to go ask fontconfig underneath. | 93 // Initialize the skia font code to go ask fontconfig underneath. |
| 94 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 94 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
| 95 font_loader_ = sk_make_sp<font_service::FontLoader>(connector); | 95 font_loader_ = sk_make_sp<font_service::FontLoader>(connector); |
| 96 SkFontConfigInterface::SetGlobal(font_loader_.get()); | 96 SkFontConfigInterface::SetGlobal(font_loader_.get()); |
| 97 #endif | 97 #endif |
| 98 | 98 |
| 99 // There is a bunch of static state in gfx::Font, by running this now, | 99 // There is a bunch of static state in gfx::Font, by running this now, |
| 100 // before any other apps load, we ensure all the state is set up. | 100 // before any other apps load, we ensure all the state is set up. |
| 101 gfx::Font(); | 101 gfx::Font(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace views | 104 } // namespace views |
| OLD | NEW |