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/resource_provider/public/cpp/resource_loader.h" | 10 #include "components/resource_provider/public/cpp/resource_loader.h" |
11 #include "components/view_manager/public/cpp/view.h" | 11 #include "components/view_manager/public/cpp/view.h" |
12 #include "mojo/converters/geometry/geometry_type_converters.h" | 12 #include "mojo/converters/geometry/geometry_type_converters.h" |
13 #include "ui/aura/env.h" | 13 #include "ui/aura/env.h" |
14 #include "ui/base/ime/input_method_initializer.h" | 14 #include "ui/base/ime/input_method_initializer.h" |
15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
16 #include "ui/base/ui_base_paths.h" | 16 #include "ui/base/ui_base_paths.h" |
17 | 17 |
| 18 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
| 19 #include "components/font_service/public/cpp/font_loader.h" |
| 20 #endif |
| 21 |
18 namespace mandoline { | 22 namespace mandoline { |
19 | 23 |
20 namespace { | 24 namespace { |
21 | 25 |
22 // Paths resources are loaded from. | 26 // Paths resources are loaded from. |
23 const char kResourceUIPak[] = "mandoline_ui.pak"; | 27 const char kResourceUIPak[] = "mandoline_ui.pak"; |
24 | 28 |
25 std::set<std::string> GetResourcePaths() { | 29 std::set<std::string> GetResourcePaths() { |
26 std::set<std::string> paths; | 30 std::set<std::string> paths; |
27 paths.insert(kResourceUIPak); | 31 paths.insert(kResourceUIPak); |
(...skipping 25 matching lines...) Expand all Loading... |
53 return; | 57 return; |
54 CHECK(resource_loader.loaded()); | 58 CHECK(resource_loader.loaded()); |
55 base::i18n::InitializeICUWithFileDescriptor( | 59 base::i18n::InitializeICUWithFileDescriptor( |
56 resource_loader.GetICUFile().TakePlatformFile(), | 60 resource_loader.GetICUFile().TakePlatformFile(), |
57 base::MemoryMappedFile::Region::kWholeFile); | 61 base::MemoryMappedFile::Region::kWholeFile); |
58 ui::RegisterPathProvider(); | 62 ui::RegisterPathProvider(); |
59 ui::ResourceBundle::InitSharedInstanceWithPakPath(base::FilePath()); | 63 ui::ResourceBundle::InitSharedInstanceWithPakPath(base::FilePath()); |
60 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 64 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
61 resource_loader.ReleaseFile(kResourceUIPak), | 65 resource_loader.ReleaseFile(kResourceUIPak), |
62 ui::SCALE_FACTOR_100P); | 66 ui::SCALE_FACTOR_100P); |
| 67 |
| 68 // Initialize the skia font code to go ask fontconfig underneath. |
| 69 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
| 70 SkFontConfigInterface::SetGlobal(new font_service::FontLoader(shell)); |
| 71 #endif |
| 72 |
63 // There is a bunch of static state in gfx::Font, by running this now, | 73 // There is a bunch of static state in gfx::Font, by running this now, |
64 // before any other apps load, we ensure all the state is set up. | 74 // before any other apps load, we ensure all the state is set up. |
65 gfx::Font(); | 75 gfx::Font(); |
66 } | 76 } |
67 | 77 |
68 } // namespace mandoline | 78 } // namespace mandoline |
OLD | NEW |