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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 } 860 }
861 #endif 861 #endif
862 862
863 local_state_->UpdateCommandLinePrefStore( 863 local_state_->UpdateCommandLinePrefStore(
864 new CommandLinePrefStore(CommandLine::ForCurrentProcess())); 864 new CommandLinePrefStore(CommandLine::ForCurrentProcess()));
865 865
866 // Reset the command line in the crash report details, since we may have 866 // Reset the command line in the crash report details, since we may have
867 // just changed it to include experiments. 867 // just changed it to include experiments.
868 crash_keys::SetSwitchesFromCommandLine(CommandLine::ForCurrentProcess()); 868 crash_keys::SetSwitchesFromCommandLine(CommandLine::ForCurrentProcess());
869 869
870 // If we're running tests (ui_task is non-null), then the ResourceBundle 870 // Mac starts it earlier in |PreMainMessageLoopStart()| (because it is
871 // has already been initialized. 871 // needed when loading the MainMenu.nib and the language doesn't depend on
872 if (parameters().ui_task && 872 // anything since it comes from Cocoa.
873 !local_state_->IsManagedPreference(prefs::kApplicationLocale)) {
874 browser_process_->SetApplicationLocale("en-US");
875 } else {
876 // Mac starts it earlier in |PreMainMessageLoopStart()| (because it is
877 // needed when loading the MainMenu.nib and the language doesn't depend on
878 // anything since it comes from Cocoa.
879 #if defined(OS_MACOSX) 873 #if defined(OS_MACOSX)
880 browser_process_->SetApplicationLocale(l10n_util::GetLocaleOverride()); 874 std::string locale =
875 parameters().ui_task ? "en-US" : l10n_util::GetLocaleOverride();
876 browser_process_->SetApplicationLocale(locale);
881 #else 877 #else
882 const std::string locale = 878 const std::string locale =
883 local_state_->GetString(prefs::kApplicationLocale); 879 local_state_->GetString(prefs::kApplicationLocale);
884 880
885 // On a POSIX OS other than ChromeOS, the parameter that is passed to the 881 // On a POSIX OS other than ChromeOS, the parameter that is passed to the
886 // method InitSharedInstance is ignored. 882 // method InitSharedInstance is ignored.
887 883
888 TRACE_EVENT_BEGIN0("startup", 884 TRACE_EVENT_BEGIN0("startup",
889 "ChromeBrowserMainParts::PreCreateThreadsImpl:InitResourceBundle"); 885 "ChromeBrowserMainParts::PreCreateThreadsImpl:InitResourceBundle");
890 const std::string loaded_locale = 886 const std::string loaded_locale =
891 ResourceBundle::InitSharedInstanceWithLocale(locale, NULL); 887 ResourceBundle::InitSharedInstanceWithLocale(locale, NULL);
892 TRACE_EVENT_END0("startup", 888 TRACE_EVENT_END0("startup",
893 "ChromeBrowserMainParts::PreCreateThreadsImpl:InitResourceBundle"); 889 "ChromeBrowserMainParts::PreCreateThreadsImpl:InitResourceBundle");
894 890
895 if (loaded_locale.empty() && 891 if (loaded_locale.empty() &&
896 !parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) { 892 !parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) {
897 ShowMissingLocaleMessageBox(); 893 ShowMissingLocaleMessageBox();
898 return chrome::RESULT_CODE_MISSING_DATA; 894 return chrome::RESULT_CODE_MISSING_DATA;
899 } 895 }
900 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale; 896 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale;
901 browser_process_->SetApplicationLocale(loaded_locale); 897 browser_process_->SetApplicationLocale(loaded_locale);
902 898
903 base::FilePath resources_pack_path; 899 base::FilePath resources_pack_path;
904 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); 900 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path);
905 { 901 {
906 TRACE_EVENT0("startup", 902 TRACE_EVENT0("startup",
907 "ChromeBrowserMainParts::PreCreateThreadsImpl:AddDataPack"); 903 "ChromeBrowserMainParts::PreCreateThreadsImpl:AddDataPack");
908 ResourceBundle::GetSharedInstance().AddDataPackFromPath( 904 ResourceBundle::GetSharedInstance().AddDataPackFromPath(
909 resources_pack_path, ui::SCALE_FACTOR_NONE); 905 resources_pack_path, ui::SCALE_FACTOR_NONE);
910 } 906 }
911 #endif // defined(OS_MACOSX) 907 #endif // defined(OS_MACOSX)
912 }
913 908
914 #if defined(TOOLKIT_GTK) 909 #if defined(TOOLKIT_GTK)
915 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str()); 910 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str());
916 #endif 911 #endif
917 912
918 // Android does first run in Java instead of native. 913 // Android does first run in Java instead of native.
919 // Chrome OS has its own out-of-box-experience code. 914 // Chrome OS has its own out-of-box-experience code.
920 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 915 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
921 // On first run, we need to process the predictor preferences before the 916 // On first run, we need to process the predictor preferences before the
922 // browser's profile_manager object is created, but after ResourceBundle 917 // browser's profile_manager object is created, but after ResourceBundle
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 chromeos::CrosSettings::Shutdown(); 1676 chromeos::CrosSettings::Shutdown();
1682 #endif 1677 #endif
1683 #endif 1678 #endif
1684 } 1679 }
1685 1680
1686 // Public members: 1681 // Public members:
1687 1682
1688 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1683 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1689 chrome_extra_parts_.push_back(parts); 1684 chrome_extra_parts_.push_back(parts);
1690 } 1685 }
OLDNEW
« 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