Index: chrome/browser/chrome_browser_main.cc |
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc |
index 8940a678debc0be547517e8a6bf95f1067db07d9..333480c582ee09bd035cc501e4219d7b847abd60 100644 |
--- a/chrome/browser/chrome_browser_main.cc |
+++ b/chrome/browser/chrome_browser_main.cc |
@@ -33,8 +33,6 @@ |
#include "chrome/browser/background/background_mode_manager.h" |
#include "chrome/browser/browser_process_impl.h" |
#include "chrome/browser/browser_shutdown.h" |
-#include "chrome/browser/chrome_browser_main_gtk.h" |
-#include "chrome/browser/chrome_browser_main_win.h" |
#include "chrome/browser/defaults.h" |
#include "chrome/browser/extensions/default_apps_trial.h" |
#include "chrome/browser/extensions/extension_protocols.h" |
@@ -121,10 +119,6 @@ |
#include "chrome/app/breakpad_linux.h" |
#endif |
-#if defined(TOOLKIT_USES_GTK) |
-#include "chrome/browser/ui/gtk/gtk_util.h" |
-#endif |
- |
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
#include "chrome/browser/first_run/upgrade_util_linux.h" |
#endif |
@@ -160,6 +154,7 @@ |
#include "base/win/windows_version.h" |
#include "chrome/browser/browser_trial.h" |
#include "chrome/browser/browser_util_win.h" |
+#include "chrome/browser/chrome_browser_main_win.h" |
#include "chrome/browser/first_run/try_chrome_dialog_view.h" |
#include "chrome/browser/first_run/upgrade_util_win.h" |
#include "chrome/browser/fragmentation_checker_win.h" |
@@ -194,6 +189,7 @@ |
#endif |
#if defined(TOOLKIT_USES_GTK) |
+#include "chrome/browser/ui/gtk/gtk_util.h" |
#include "ui/gfx/gtk_util.h" |
#endif |
@@ -201,6 +197,10 @@ |
#include "ui/base/touch/touch_factory.h" |
#endif |
+#if defined(USE_X11) |
+#include "chrome/browser/chrome_browser_main_x11.h" |
+#endif |
+ |
#if defined(USE_AURA) |
#include "chrome/browser/ui/views/aura/chrome_shell_delegate.h" |
#include "ui/aura/desktop.h" |
@@ -685,7 +685,9 @@ const char kMissingLocaleDataMessage[] = |
ChromeBrowserMainParts::ChromeBrowserMainParts( |
const MainFunctionParams& parameters) |
- : BrowserMainParts(parameters), |
+ : content::BrowserMainParts(), |
jam
2011/10/24 19:36:00
not necessary
stevenjb
2011/10/25 02:51:04
Done.
|
+ parameters_(parameters), |
+ parsed_command_line_(parameters.command_line_), |
shutdown_watcher_(new ShutdownWatcherHelper()), |
record_search_engine_(false), |
translate_manager_(NULL), |
@@ -702,12 +704,12 @@ ChromeBrowserMainParts::~ChromeBrowserMainParts() { |
// This will be called after the command-line has been mutated by about:flags |
MetricsService* ChromeBrowserMainParts::SetupMetricsAndFieldTrials( |
- const CommandLine& parsed_command_line, |
PrefService* local_state) { |
// Must initialize metrics after labs have been converted into switches, |
// but before field trials are set up (so that client ID is available for |
// one-time randomized field trials). |
- MetricsService* metrics = InitializeMetrics(parsed_command_line, local_state); |
+ MetricsService* metrics = InitializeMetrics( |
+ parsed_command_line(), local_state); |
jam
2011/10/24 19:36:00
nit: now that this is a member variable, just pars
stevenjb
2011/10/25 02:51:04
Done.
|
// Initialize FieldTrialList to support FieldTrials that use one-time |
// randomization. The client ID will be empty if the user has not opted |
@@ -1179,11 +1181,7 @@ DLLEXPORT void __cdecl RelaunchChromeBrowserWithNewCommandLineIfNeeded() { |
} |
#endif |
-void ChromeBrowserMainParts::PreMainMessageLoopRun() { |
- set_result_code(PreMainMessageLoopRunInternal()); |
-} |
- |
-int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { |
+int ChromeBrowserMainParts::PreMainMessageLoopRun() { |
run_message_loop_ = false; |
FilePath user_data_dir; |
#if defined(OS_WIN) |
@@ -1409,8 +1407,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { |
// Now the command line has been mutated based on about:flags, we can |
// set up metrics and initialize field trials. |
- MetricsService* metrics = |
- SetupMetricsAndFieldTrials(parsed_command_line(), local_state); |
+ MetricsService* metrics = SetupMetricsAndFieldTrials(local_state); |
// Now that all preferences have been registered, set the install date |
// for the uninstall metrics if this is our first run. This only actually |
@@ -1466,12 +1463,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { |
if (parsed_command_line().HasSwitch(switches::kUninstall)) { |
return DoUninstallTasks(already_running); |
} |
-#endif |
if (parsed_command_line().HasSwitch(switches::kHideIcons) || |
parsed_command_line().HasSwitch(switches::kShowIcons)) { |
- return HandleIconsCommands(parsed_command_line()); |
+ return ChromeBrowserMainPartsWin::HandleIconsCommands( |
+ parsed_command_line()); |
jam
2011/10/24 19:36:00
ditto
stevenjb
2011/10/25 02:51:04
Done.
|
} |
+#endif |
+ |
if (parsed_command_line().HasSwitch(switches::kMakeDefaultBrowser)) { |
return ShellIntegration::SetAsDefaultBrowser() ? |
static_cast<int>(content::RESULT_CODE_NORMAL_EXIT) : |
@@ -1624,7 +1623,6 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { |
// Do the tasks if chrome has been upgraded while it was last running. |
if (!already_running && upgrade_util::DoUpgradeTasks(parsed_command_line())) |
return content::RESULT_CODE_NORMAL_EXIT; |
-#endif |
// Check if there is any machine level Chrome installed on the current |
// machine. If yes and the current Chrome process is user level, we do not |
@@ -1635,9 +1633,10 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { |
// processes etc). |
// Do not allow this to occur for Chrome Frame user-to-system handoffs. |
if (!parsed_command_line().HasSwitch(switches::kChromeFrame) && |
- CheckMachineLevelInstall()) { |
+ ChromeBrowserMainPartsWin::CheckMachineLevelInstall()) { |
return chrome::RESULT_CODE_MACHINE_LEVEL_INSTALL_EXISTS; |
} |
+#endif |
// Create the TranslateManager singleton. |
translate_manager_ = TranslateManager::GetInstance(); |
@@ -1685,10 +1684,13 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { |
g_browser_process->profile_manager()->OnImportFinished(profile_); |
} // if (is_first_run) |
+#if defined(OS_WIN) |
// Sets things up so that if we crash from this point on, a dialog will |
// popup asking the user to restart chrome. It is done this late to avoid |
// testing against a bunch of special cases that are taken care early on. |
- PrepareRestartOnCrashEnviroment(parsed_command_line()); |
+ ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( |
+ parsed_command_line()); |
+#endif // OS_WIN |
// Start watching for hangs during startup. We disarm this hang detector when |
// ThreadWatcher takes over or when browser is shutdown. |
@@ -1700,8 +1702,10 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { |
// This could be run as late as WM_QUERYENDSESSION for system update reboots, |
// but should run on startup if extended to handle crashes/hangs/patches. |
// Also, better to run once here than once for each HWND's WM_QUERYENDSESSION. |
- if (base::win::GetVersion() >= base::win::VERSION_VISTA) |
- RegisterApplicationRestart(parsed_command_line()); |
+ if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
+ ChromeBrowserMainPartsWin::RegisterApplicationRestart( |
+ parsed_command_line()); |
+ } |
#endif // OS_WIN |
#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) |
@@ -1938,9 +1942,9 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunInternal() { |
return result_code; |
} |
-void ChromeBrowserMainParts::MainMessageLoopRun() { |
+bool ChromeBrowserMainParts::MainMessageLoopRun() { |
if (!run_message_loop_) |
- return; |
+ return true; // Don't run the default message loop. |
// This should be invoked as close to the start of the browser's |
// UI thread message loop as possible to get a stable measurement |
@@ -1961,6 +1965,8 @@ void ChromeBrowserMainParts::MainMessageLoopRun() { |
chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", |
true); |
#endif |
+ |
+ return true; |
} |
void ChromeBrowserMainParts::PostMainMessageLoopRun() { |