Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: chrome/app/chrome_main_delegate.cc

Issue 10876056: Additional file descriptor mappings for Android (Closed) Base URL: http://git.chromium.org/chromium/src.git@x509
Patch Set: Add descriptor_android.h to gyp Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/chrome_main_delegate.cc
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc
index 9a83f2ec1f058446a31c642f9560c8449523b695..158e0a7343e7e5cc4917e63aa8613b129d0eb389 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 sandbox prevents us from accessing our .pak files directly.
+ // Therefore file descriptors to the .pak files that we need are passed in
+ // at process creation time.
+ 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;
« no previous file with comments | « no previous file | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698