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

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 190663012: Run ContentMain in a browser_test's browser process. This removes duplication of code in the browse… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: try to fix android by restoring old path just for it Created 6 years, 9 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 | « chrome/browser/apps/web_view_browsertest.cc ('k') | chrome/browser/chrome_browser_main_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_browser_main.cc
===================================================================
--- chrome/browser/chrome_browser_main.cc (revision 257432)
+++ chrome/browser/chrome_browser_main.cc (working copy)
@@ -867,49 +867,44 @@
// just changed it to include experiments.
crash_keys::SetSwitchesFromCommandLine(CommandLine::ForCurrentProcess());
- // If we're running tests (ui_task is non-null), then the ResourceBundle
- // has already been initialized.
- if (parameters().ui_task &&
- !local_state_->IsManagedPreference(prefs::kApplicationLocale)) {
- browser_process_->SetApplicationLocale("en-US");
- } else {
- // Mac starts it earlier in |PreMainMessageLoopStart()| (because it is
- // needed when loading the MainMenu.nib and the language doesn't depend on
- // anything since it comes from Cocoa.
+ // Mac starts it earlier in |PreMainMessageLoopStart()| (because it is
+ // needed when loading the MainMenu.nib and the language doesn't depend on
+ // anything since it comes from Cocoa.
#if defined(OS_MACOSX)
- browser_process_->SetApplicationLocale(l10n_util::GetLocaleOverride());
+ std::string locale =
+ parameters().ui_task ? "en-US" : l10n_util::GetLocaleOverride();
+ browser_process_->SetApplicationLocale(locale);
#else
- const std::string locale =
- local_state_->GetString(prefs::kApplicationLocale);
+ const std::string locale =
+ local_state_->GetString(prefs::kApplicationLocale);
- // On a POSIX OS other than ChromeOS, the parameter that is passed to the
- // method InitSharedInstance is ignored.
+ // On a POSIX OS other than ChromeOS, the parameter that is passed to the
+ // method InitSharedInstance is ignored.
- TRACE_EVENT_BEGIN0("startup",
- "ChromeBrowserMainParts::PreCreateThreadsImpl:InitResourceBundle");
- const std::string loaded_locale =
- ResourceBundle::InitSharedInstanceWithLocale(locale, NULL);
- TRACE_EVENT_END0("startup",
- "ChromeBrowserMainParts::PreCreateThreadsImpl:InitResourceBundle");
+ TRACE_EVENT_BEGIN0("startup",
+ "ChromeBrowserMainParts::PreCreateThreadsImpl:InitResourceBundle");
+ const std::string loaded_locale =
+ ResourceBundle::InitSharedInstanceWithLocale(locale, NULL);
+ TRACE_EVENT_END0("startup",
+ "ChromeBrowserMainParts::PreCreateThreadsImpl:InitResourceBundle");
- if (loaded_locale.empty() &&
- !parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) {
- ShowMissingLocaleMessageBox();
- return chrome::RESULT_CODE_MISSING_DATA;
- }
- CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale;
- browser_process_->SetApplicationLocale(loaded_locale);
+ if (loaded_locale.empty() &&
+ !parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) {
+ ShowMissingLocaleMessageBox();
+ return chrome::RESULT_CODE_MISSING_DATA;
+ }
+ CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale;
+ browser_process_->SetApplicationLocale(loaded_locale);
- base::FilePath resources_pack_path;
- PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path);
- {
- TRACE_EVENT0("startup",
- "ChromeBrowserMainParts::PreCreateThreadsImpl:AddDataPack");
- ResourceBundle::GetSharedInstance().AddDataPackFromPath(
- resources_pack_path, ui::SCALE_FACTOR_NONE);
- }
-#endif // defined(OS_MACOSX)
+ base::FilePath resources_pack_path;
+ PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path);
+ {
+ TRACE_EVENT0("startup",
+ "ChromeBrowserMainParts::PreCreateThreadsImpl:AddDataPack");
+ ResourceBundle::GetSharedInstance().AddDataPackFromPath(
+ resources_pack_path, ui::SCALE_FACTOR_NONE);
}
+#endif // defined(OS_MACOSX)
#if defined(TOOLKIT_GTK)
g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str());
« no previous file with comments | « chrome/browser/apps/web_view_browsertest.cc ('k') | chrome/browser/chrome_browser_main_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698