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 "mandoline/ui/aura/aura_init.h" | 5 #include "mandoline/ui/aura/aura_init.h" |
6 | 6 |
7 #include "base/i18n/icu_util.h" | 7 #include "base/i18n/icu_util.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "components/mus/public/cpp/view.h" | 10 #include "components/mus/public/cpp/view.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 return; | 63 return; |
64 resource_provider::ResourceLoader resource_loader( | 64 resource_provider::ResourceLoader resource_loader( |
65 shell, GetResourcePaths(resource_file_)); | 65 shell, GetResourcePaths(resource_file_)); |
66 if (!resource_loader.BlockUntilLoaded()) | 66 if (!resource_loader.BlockUntilLoaded()) |
67 return; | 67 return; |
68 CHECK(resource_loader.loaded()); | 68 CHECK(resource_loader.loaded()); |
69 base::i18n::InitializeICUWithFileDescriptor( | 69 base::i18n::InitializeICUWithFileDescriptor( |
70 resource_loader.GetICUFile().TakePlatformFile(), | 70 resource_loader.GetICUFile().TakePlatformFile(), |
71 base::MemoryMappedFile::Region::kWholeFile); | 71 base::MemoryMappedFile::Region::kWholeFile); |
72 ui::RegisterPathProvider(); | 72 ui::RegisterPathProvider(); |
73 ui::ResourceBundle::InitSharedInstanceWithPakPath(base::FilePath()); | 73 base::File pak_file = resource_loader.ReleaseFile(resource_file_); |
| 74 base::File pak_file_2 = pak_file.Duplicate(); |
| 75 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( |
| 76 pak_file.Pass(), base::MemoryMappedFile::Region::kWholeFile); |
74 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 77 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
75 resource_loader.ReleaseFile(resource_file_), ui::SCALE_FACTOR_100P); | 78 pak_file_2.Pass(), ui::SCALE_FACTOR_100P); |
76 | 79 |
77 // Initialize the skia font code to go ask fontconfig underneath. | 80 // Initialize the skia font code to go ask fontconfig underneath. |
78 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 81 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
79 font_loader_ = skia::AdoptRef(new font_service::FontLoader(shell)); | 82 font_loader_ = skia::AdoptRef(new font_service::FontLoader(shell)); |
80 SkFontConfigInterface::SetGlobal(font_loader_.get()); | 83 SkFontConfigInterface::SetGlobal(font_loader_.get()); |
81 #endif | 84 #endif |
82 | 85 |
83 // There is a bunch of static state in gfx::Font, by running this now, | 86 // There is a bunch of static state in gfx::Font, by running this now, |
84 // before any other apps load, we ensure all the state is set up. | 87 // before any other apps load, we ensure all the state is set up. |
85 gfx::Font(); | 88 gfx::Font(); |
86 } | 89 } |
87 | 90 |
88 } // namespace mandoline | 91 } // namespace mandoline |
OLD | NEW |