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

Unified Diff: android_webview/browser/aw_browser_main_parts.cc

Issue 1193613002: Convert Android WebView to store locale .pak files as res/raw resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-extractor-init
Patch Set: rebase again Created 5 years, 6 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: android_webview/browser/aw_browser_main_parts.cc
diff --git a/android_webview/browser/aw_browser_main_parts.cc b/android_webview/browser/aw_browser_main_parts.cc
index dc75d4b9902363aaf4ac7aa414c829081f390751..7e587344c846300b38ea0d0645b50ce5dfb1f9fa 100644
--- a/android_webview/browser/aw_browser_main_parts.cc
+++ b/android_webview/browser/aw_browser_main_parts.cc
@@ -26,6 +26,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/base/resource/resource_bundle_android.h"
#include "ui/base/ui_base_paths.h"
#include "ui/gl/gl_surface.h"
@@ -62,15 +63,15 @@ int AwBrowserMainParts::PreCreateThreads() {
base::android::GetDefaultLocale(),
NULL,
ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
- std::string locale =
- "assets/" + l10n_util::GetApplicationLocale(std::string()) + ".pak";
- int pak_fd = base::android::OpenApkAsset(locale, &pak_region);
+ std::string locale = l10n_util::GetApplicationLocale(std::string());
+ std::string pak_path = ui::GetPathForAndroidLocalePakWithinApk(locale);
+ int pak_fd = base::android::OpenApkAsset(pak_path, &pak_region);
if (pak_fd != -1) {
ui::ResourceBundle::CleanupSharedInstance();
ui::ResourceBundle::InitSharedInstanceWithPakFileRegion(
base::File(pak_fd), pak_region);
} else {
- LOG(WARNING) << "Failed to load " << locale << ".pak from the apk too. "
+ LOG(WARNING) << "Failed to load " << locale << ".pak from the apk. "
"Bringing up WebView without any locale";
}

Powered by Google App Engine
This is Rietveld 408576698