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

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: fix long line errors Created 8 years, 4 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
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;
« no previous file with comments | « no previous file | chrome/browser/chrome_content_browser_client.cc » ('j') | chrome/browser/chrome_content_browser_client.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698