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

Unified Diff: headless/lib/headless_content_main_delegate.cc

Issue 2591833002: headless: Load resources based on locale (Closed)
Patch Set: Created 4 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/headless_content_main_delegate.cc
diff --git a/headless/lib/headless_content_main_delegate.cc b/headless/lib/headless_content_main_delegate.cc
index 00b34fbdb7141e1d7906e0a36b8290382ee77d1d..4b7c1609035b5974e46563ca497c1ae4087f43f0 100644
--- a/headless/lib/headless_content_main_delegate.cc
+++ b/headless/lib/headless_content_main_delegate.cc
@@ -14,6 +14,7 @@
#include "headless/lib/browser/headless_browser_impl.h"
#include "headless/lib/browser/headless_content_browser_client.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/base/ui_base_switches.h"
#include "ui/gfx/switches.h"
#include "ui/gl/gl_switches.h"
#include "ui/ozone/public/ozone_switches.h"
@@ -114,14 +115,20 @@ void HeadlessContentMainDelegate::InitializeResourceBundle() {
base::FilePath pak_file;
bool result = PathService::Get(base::DIR_MODULE, &dir_module);
DCHECK(result);
+
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ const std::string locale = command_line->GetSwitchValueASCII(switches::kLang);
+ ui::ResourceBundle::InitSharedInstanceWithLocale(
+ locale, nullptr, ui::ResourceBundle::DO_NOT_LOAD_COMMON_RESOURCES);
+
// Try loading the headless library pak file first. If it doesn't exist (i.e.,
// when we're running with the --headless switch), fall back to the browser's
// resource pak.
pak_file = dir_module.Append(FILE_PATH_LITERAL("headless_lib.pak"));
if (!base::PathExists(pak_file))
pak_file = dir_module.Append(FILE_PATH_LITERAL("resources.pak"));
- // TODO(skyostil): Use the locale-based loader instead.
- ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file);
+ ResourceBundle::GetSharedInstance().AddDataPackFromPath(
+ pak_file, ui::SCALE_FACTOR_NONE);
}
content::ContentBrowserClient*
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698