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