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