| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // torn down, when we're in a bad state. | 67 // torn down, when we're in a bad state. |
| 68 font_loader_->Shutdown(); | 68 font_loader_->Shutdown(); |
| 69 } | 69 } |
| 70 #endif | 70 #endif |
| 71 } | 71 } |
| 72 | 72 |
| 73 void AuraInit::InitializeResources(shell::Connector* connector) { | 73 void AuraInit::InitializeResources(shell::Connector* connector) { |
| 74 if (ui::ResourceBundle::HasSharedInstance()) | 74 if (ui::ResourceBundle::HasSharedInstance()) |
| 75 return; | 75 return; |
| 76 | 76 |
| 77 #if 0 |
| 77 std::set<std::string> resource_paths({resource_file_}); | 78 std::set<std::string> resource_paths({resource_file_}); |
| 78 if (!resource_file_200_.empty()) | 79 if (!resource_file_200_.empty()) |
| 79 resource_paths.insert(resource_file_200_); | 80 resource_paths.insert(resource_file_200_); |
| 81 #else |
| 82 std::set<std::string> resource_paths({ |
| 83 "chrome_100_percent.pak", "chrome_200_percent.pak", "resources.pak", |
| 84 }); |
| 85 #endif |
| 86 |
| 87 resource_file_ = "chrome_100_percent.pak"; |
| 88 resource_file_200_ = "chrome_200_percent.pak"; |
| 80 | 89 |
| 81 catalog::ResourceLoader loader; | 90 catalog::ResourceLoader loader; |
| 82 filesystem::mojom::DirectoryPtr directory; | 91 filesystem::mojom::DirectoryPtr directory; |
| 83 connector->ConnectToInterface("mojo:catalog", &directory); | 92 connector->ConnectToInterface("mojo:catalog", &directory); |
| 84 CHECK(loader.OpenFiles(std::move(directory), resource_paths)); | 93 CHECK(loader.OpenFiles(std::move(directory), resource_paths)); |
| 85 ui::RegisterPathProvider(); | 94 ui::RegisterPathProvider(); |
| 86 base::File pak_file = loader.TakeFile(resource_file_); | 95 base::File pak_file = loader.TakeFile("resources.pak"); |
| 87 base::File pak_file_2 = pak_file.Duplicate(); | 96 base::File pak_file_2 = loader.TakeFile("chrome_100_percent.pak"); |
| 88 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( | 97 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( |
| 89 std::move(pak_file), base::MemoryMappedFile::Region::kWholeFile); | 98 std::move(pak_file), base::MemoryMappedFile::Region::kWholeFile); |
| 90 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 99 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
| 91 std::move(pak_file_2), ui::SCALE_FACTOR_100P); | 100 std::move(pak_file_2), ui::SCALE_FACTOR_100P); |
| 92 if (!resource_file_200_.empty()) | 101 if (!resource_file_200_.empty()) |
| 93 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 102 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
| 94 loader.TakeFile(resource_file_200_), ui::SCALE_FACTOR_200P); | 103 loader.TakeFile(resource_file_200_), ui::SCALE_FACTOR_200P); |
| 95 | 104 |
| 96 // Initialize the skia font code to go ask fontconfig underneath. | 105 // Initialize the skia font code to go ask fontconfig underneath. |
| 97 #if defined(OS_LINUX) | 106 #if defined(OS_LINUX) |
| 98 font_loader_ = sk_make_sp<font_service::FontLoader>(connector); | 107 font_loader_ = sk_make_sp<font_service::FontLoader>(connector); |
| 99 SkFontConfigInterface::SetGlobal(font_loader_.get()); | 108 SkFontConfigInterface::SetGlobal(font_loader_.get()); |
| 100 #endif | 109 #endif |
| 101 | 110 |
| 102 // There is a bunch of static state in gfx::Font, by running this now, | 111 // There is a bunch of static state in gfx::Font, by running this now, |
| 103 // before any other apps load, we ensure all the state is set up. | 112 // before any other apps load, we ensure all the state is set up. |
| 104 gfx::Font(); | 113 gfx::Font(); |
| 105 } | 114 } |
| 106 | 115 |
| 107 } // namespace views | 116 } // namespace views |
| OLD | NEW |