OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 // The renderer sandbox prevents us from accessing our .pak files directly. | 870 // The renderer sandbox prevents us from accessing our .pak files directly. |
871 // Therefore file descriptors to the .pak files that we need are passed in | 871 // Therefore file descriptors to the .pak files that we need are passed in |
872 // at process creation time. | 872 // at process creation time. |
873 auto* global_descriptors = base::GlobalDescriptors::GetInstance(); | 873 auto* global_descriptors = base::GlobalDescriptors::GetInstance(); |
874 int pak_fd = global_descriptors->Get(kAndroidLocalePakDescriptor); | 874 int pak_fd = global_descriptors->Get(kAndroidLocalePakDescriptor); |
875 base::MemoryMappedFile::Region pak_region = | 875 base::MemoryMappedFile::Region pak_region = |
876 global_descriptors->GetRegion(kAndroidLocalePakDescriptor); | 876 global_descriptors->GetRegion(kAndroidLocalePakDescriptor); |
877 ResourceBundle::InitSharedInstanceWithPakFileRegion(base::File(pak_fd), | 877 ResourceBundle::InitSharedInstanceWithPakFileRegion(base::File(pak_fd), |
878 pak_region); | 878 pak_region); |
879 | 879 |
880 // Load secondary locale .pak file if it exists. | |
881 pak_fd = global_descriptors->MaybeGet(kAndroidSecondaryLocalePakDescriptor); | |
882 if (pak_fd != -1) { | |
883 pak_region = global_descriptors->GetRegion( | |
884 kAndroidSecondaryLocalePakDescriptor); | |
885 ResourceBundle::GetSharedInstance(). | |
886 LoadSecondaryLocaleDataWithPakFileRegion( | |
887 base::File(pak_fd), pak_region); | |
888 } | |
889 | |
890 int extra_pak_keys[] = { | 880 int extra_pak_keys[] = { |
891 kAndroidChrome100PercentPakDescriptor, | 881 kAndroidChrome100PercentPakDescriptor, |
892 kAndroidUIResourcesPakDescriptor, | 882 kAndroidUIResourcesPakDescriptor, |
893 }; | 883 }; |
894 for (size_t i = 0; i < arraysize(extra_pak_keys); ++i) { | 884 for (size_t i = 0; i < arraysize(extra_pak_keys); ++i) { |
895 pak_fd = global_descriptors->Get(extra_pak_keys[i]); | 885 pak_fd = global_descriptors->Get(extra_pak_keys[i]); |
896 pak_region = global_descriptors->GetRegion(extra_pak_keys[i]); | 886 pak_region = global_descriptors->GetRegion(extra_pak_keys[i]); |
897 ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( | 887 ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( |
898 base::File(pak_fd), pak_region, ui::SCALE_FACTOR_100P); | 888 base::File(pak_fd), pak_region, ui::SCALE_FACTOR_100P); |
899 } | 889 } |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 | 1222 |
1233 std::unique_ptr<service_manager::Service> | 1223 std::unique_ptr<service_manager::Service> |
1234 ChromeMainDelegate::CreateEmbeddedService(const std::string& service_name) { | 1224 ChromeMainDelegate::CreateEmbeddedService(const std::string& service_name) { |
1235 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 1225 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
1236 auto mash_service = CreateEmbeddedMashService(service_name); | 1226 auto mash_service = CreateEmbeddedMashService(service_name); |
1237 if (mash_service) | 1227 if (mash_service) |
1238 return mash_service; | 1228 return mash_service; |
1239 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 1229 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
1240 return nullptr; | 1230 return nullptr; |
1241 } | 1231 } |
OLD | NEW |