| 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 "base/i18n/icu_util.h" | |
| 8 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 9 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 10 #include "components/resource_provider/public/cpp/resource_loader.h" | 9 #include "components/resource_provider/public/cpp/resource_loader.h" |
| 11 #include "mojo/application/public/cpp/application_impl.h" | 10 #include "mojo/application/public/cpp/application_impl.h" |
| 12 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
| 13 #include "ui/base/ime/input_method_initializer.h" | 12 #include "ui/base/ime/input_method_initializer.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
| 15 #include "ui/base/ui_base_paths.h" | 14 #include "ui/base/ui_base_paths.h" |
| 16 | 15 |
| 17 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 16 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 51 } |
| 53 | 52 |
| 54 void AuraInit::InitializeResources(mojo::ApplicationImpl* app) { | 53 void AuraInit::InitializeResources(mojo::ApplicationImpl* app) { |
| 55 if (ui::ResourceBundle::HasSharedInstance()) | 54 if (ui::ResourceBundle::HasSharedInstance()) |
| 56 return; | 55 return; |
| 57 resource_provider::ResourceLoader resource_loader( | 56 resource_provider::ResourceLoader resource_loader( |
| 58 app, GetResourcePaths(resource_file_)); | 57 app, GetResourcePaths(resource_file_)); |
| 59 if (!resource_loader.BlockUntilLoaded()) | 58 if (!resource_loader.BlockUntilLoaded()) |
| 60 return; | 59 return; |
| 61 CHECK(resource_loader.loaded()); | 60 CHECK(resource_loader.loaded()); |
| 62 base::i18n::InitializeICUWithFileDescriptor( | |
| 63 resource_loader.GetICUFile().TakePlatformFile(), | |
| 64 base::MemoryMappedFile::Region::kWholeFile); | |
| 65 ui::RegisterPathProvider(); | 61 ui::RegisterPathProvider(); |
| 66 base::File pak_file = resource_loader.ReleaseFile(resource_file_); | 62 base::File pak_file = resource_loader.ReleaseFile(resource_file_); |
| 67 base::File pak_file_2 = pak_file.Duplicate(); | 63 base::File pak_file_2 = pak_file.Duplicate(); |
| 68 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( | 64 ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( |
| 69 pak_file.Pass(), base::MemoryMappedFile::Region::kWholeFile); | 65 pak_file.Pass(), base::MemoryMappedFile::Region::kWholeFile); |
| 70 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 66 ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
| 71 pak_file_2.Pass(), ui::SCALE_FACTOR_100P); | 67 pak_file_2.Pass(), ui::SCALE_FACTOR_100P); |
| 72 | 68 |
| 73 // Initialize the skia font code to go ask fontconfig underneath. | 69 // Initialize the skia font code to go ask fontconfig underneath. |
| 74 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 70 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
| 75 font_loader_ = skia::AdoptRef(new font_service::FontLoader(app->shell())); | 71 font_loader_ = skia::AdoptRef(new font_service::FontLoader(app->shell())); |
| 76 SkFontConfigInterface::SetGlobal(font_loader_.get()); | 72 SkFontConfigInterface::SetGlobal(font_loader_.get()); |
| 77 #endif | 73 #endif |
| 78 | 74 |
| 79 // There is a bunch of static state in gfx::Font, by running this now, | 75 // There is a bunch of static state in gfx::Font, by running this now, |
| 80 // before any other apps load, we ensure all the state is set up. | 76 // before any other apps load, we ensure all the state is set up. |
| 81 gfx::Font(); | 77 gfx::Font(); |
| 82 } | 78 } |
| 83 | 79 |
| 84 } // namespace views | 80 } // namespace views |
| OLD | NEW |