Chromium Code Reviews| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 660 // this value could be passed in a different way. | 660 // this value could be passed in a different way. |
| 661 const std::string locale = | 661 const std::string locale = |
| 662 command_line.GetSwitchValueASCII(switches::kLang); | 662 command_line.GetSwitchValueASCII(switches::kLang); |
| 663 #if defined(OS_ANDROID) | 663 #if defined(OS_ANDROID) |
| 664 // The renderer sandbox prevents us from accessing our .pak files directly. | 664 // The renderer sandbox prevents us from accessing our .pak files directly. |
| 665 // Therefore file descriptors to the .pak files that we need are passed in | 665 // Therefore file descriptors to the .pak files that we need are passed in |
| 666 // at process creation time. | 666 // at process creation time. |
| 667 int locale_pak_fd = base::GlobalDescriptors::GetInstance()->MaybeGet( | 667 int locale_pak_fd = base::GlobalDescriptors::GetInstance()->MaybeGet( |
| 668 kAndroidLocalePakDescriptor); | 668 kAndroidLocalePakDescriptor); |
| 669 CHECK(locale_pak_fd != -1); | 669 CHECK(locale_pak_fd != -1); |
| 670 ResourceBundle::InitSharedInstanceWithPakFile(locale_pak_fd, false); | 670 ResourceBundle::InitSharedInstanceWithPakFile(base::File(locale_pak_fd), |
| 671 false); | |
|
cpu_(ooo_6.6-7.5)
2013/12/21 23:06:28
so locale_pak_fd will be closed at this point sinc
rvargas (doing something else)
2013/12/27 23:54:39
The file is effectively passed to ResourceBundle,
rvargas (doing something else)
2013/12/28 02:30:37
Filed bug 330930, because GlobalDescriptors doesn'
| |
| 671 | 672 |
| 672 int extra_pak_keys[] = { | 673 int extra_pak_keys[] = { |
| 673 kAndroidChrome100PercentPakDescriptor, | 674 kAndroidChrome100PercentPakDescriptor, |
| 674 kAndroidUIResourcesPakDescriptor, | 675 kAndroidUIResourcesPakDescriptor, |
| 675 }; | 676 }; |
| 676 for (size_t i = 0; i < arraysize(extra_pak_keys); ++i) { | 677 for (size_t i = 0; i < arraysize(extra_pak_keys); ++i) { |
| 677 int pak_fd = | 678 int pak_fd = |
| 678 base::GlobalDescriptors::GetInstance()->MaybeGet(extra_pak_keys[i]); | 679 base::GlobalDescriptors::GetInstance()->MaybeGet(extra_pak_keys[i]); |
| 679 CHECK(pak_fd != -1); | 680 CHECK(pak_fd != -1); |
| 680 ResourceBundle::GetSharedInstance().AddDataPackFromFile( | 681 ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
| 681 pak_fd, ui::SCALE_FACTOR_100P); | 682 base::File(pak_fd), ui::SCALE_FACTOR_100P); |
| 682 } | 683 } |
| 683 | 684 |
| 684 base::i18n::SetICUDefaultLocale(locale); | 685 base::i18n::SetICUDefaultLocale(locale); |
| 685 const std::string loaded_locale = locale; | 686 const std::string loaded_locale = locale; |
| 686 #else | 687 #else |
| 687 const std::string loaded_locale = | 688 const std::string loaded_locale = |
| 688 ResourceBundle::InitSharedInstanceWithLocale(locale, NULL); | 689 ResourceBundle::InitSharedInstanceWithLocale(locale, NULL); |
| 689 | 690 |
| 690 base::FilePath resources_pack_path; | 691 base::FilePath resources_pack_path; |
| 691 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 692 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 856 } | 857 } |
| 857 | 858 |
| 858 content::ContentUtilityClient* | 859 content::ContentUtilityClient* |
| 859 ChromeMainDelegate::CreateContentUtilityClient() { | 860 ChromeMainDelegate::CreateContentUtilityClient() { |
| 860 #if defined(CHROME_MULTIPLE_DLL_BROWSER) | 861 #if defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 861 return NULL; | 862 return NULL; |
| 862 #else | 863 #else |
| 863 return &g_chrome_content_utility_client.Get(); | 864 return &g_chrome_content_utility_client.Get(); |
| 864 #endif | 865 #endif |
| 865 } | 866 } |
| OLD | NEW |