Index: chrome/app/chrome_main_delegate.cc |
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc |
index a1eaf52fb5ad84d823e1e74629451b29df8f7dcd..421caff0b8a18d9c7b51b98debe247a6d2a40489 100644 |
--- a/chrome/app/chrome_main_delegate.cc |
+++ b/chrome/app/chrome_main_delegate.cc |
@@ -74,6 +74,10 @@ |
#include "chrome/browser/chromeos/boot_times_loader.h" |
#endif |
+#if defined(OS_ANDROID) |
+#include "chrome/common/descriptors_android.h" |
+#endif |
+ |
#if defined(TOOLKIT_GTK) |
#include <gdk/gdk.h> |
#include <glib.h> |
@@ -591,8 +595,32 @@ void ChromeMainDelegate::PreSandboxStartup() { |
// this value could be passed in a different way. |
const std::string locale = |
command_line.GetSwitchValueASCII(switches::kLang); |
+#if defined(OS_ANDROID) |
+ // The renderer sandboxing make it that we can't access any files even that |
agl
2012/08/30 01:31:47
// The renderer sandbox prevents us from accessing
acleung
2012/08/31 23:36:33
Done.
|
+ // early. So we access our local pak file directly from a file descriptor |
+ // passed during process creation. |
+ int locale_pak_fd = base::GlobalDescriptors::GetInstance()->MaybeGet( |
+ kAndroidLocalePakDescriptor); |
+ CHECK(locale_pak_fd != -1); |
+ ResourceBundle::InitSharedInstanceWithPakFile(locale_pak_fd, false); |
+ |
+ int extra_pak_keys[] = { |
+ kAndroidChromePakDescriptor, |
+ kAndroidUIResourcesPakDescriptor, |
+ }; |
+ for (size_t i = 0; i < arraysize(extra_pak_keys); ++i) { |
+ int pak_fd = |
+ base::GlobalDescriptors::GetInstance()->MaybeGet(extra_pak_keys[i]); |
+ CHECK(pak_fd != -1); |
+ ResourceBundle::GetSharedInstance().AddDataPackFromFile( |
+ pak_fd, ui::SCALE_FACTOR_100P); |
+ } |
+ |
+ const std::string loaded_locale = locale; |
+#else |
const std::string loaded_locale = |
ResourceBundle::InitSharedInstanceWithLocale(locale, NULL); |
+#endif |
CHECK(!loaded_locale.empty()) << "Locale could not be found for " << |
locale; |