Index: chrome/browser/chrome_browser_main_win.cc |
diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc |
index 711193c7ccbeab1eb649f8f7994ca3bd7befb9d2..577443fcab916744e3ef6d77ba879b1d5d4f2043 100644 |
--- a/chrome/browser/chrome_browser_main_win.cc |
+++ b/chrome/browser/chrome_browser_main_win.cc |
@@ -74,14 +74,6 @@ void WarnAboutMinimumSystemRequirements() { |
} |
} |
-#if !defined(USE_AURA) |
-void ShowMissingLocaleMessageBox() { |
- ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), |
- ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), |
- MB_OK | MB_ICONERROR | MB_TOPMOST); |
-} |
-#endif |
- |
void RecordBrowserStartupTime() { |
// Calculate the time that has elapsed from our own process creation. |
FILETIME creation_time = {}; |
@@ -141,78 +133,32 @@ int DoUninstallTasks(bool chrome_still_running) { |
return ret; |
} |
-// Prepares the localized strings that are going to be displayed to |
-// the user if the browser process dies. These strings are stored in the |
-// environment block so they are accessible in the early stages of the |
-// chrome executable's lifetime. |
-void PrepareRestartOnCrashEnviroment(const CommandLine& parsed_command_line) { |
- // Clear this var so child processes don't show the dialog by default. |
- scoped_ptr<base::Environment> env(base::Environment::Create()); |
- env->UnSetVar(env_vars::kShowRestart); |
- |
- // For non-interactive tests we don't restart on crash. |
- if (env->HasVar(env_vars::kHeadless)) |
- return; |
- |
- // If the known command-line test options are used we don't create the |
- // environment block which means we don't get the restart dialog. |
- if (parsed_command_line.HasSwitch(switches::kBrowserCrashTest) || |
- parsed_command_line.HasSwitch(switches::kBrowserAssertTest) || |
- parsed_command_line.HasSwitch(switches::kNoErrorDialogs)) |
- return; |
- |
- // The encoding we use for the info is "title|context|direction" where |
- // direction is either env_vars::kRtlLocale or env_vars::kLtrLocale depending |
- // on the current locale. |
- string16 dlg_strings(l10n_util::GetStringUTF16(IDS_CRASH_RECOVERY_TITLE)); |
- dlg_strings.push_back('|'); |
- string16 adjusted_string( |
- l10n_util::GetStringUTF16(IDS_CRASH_RECOVERY_CONTENT)); |
- base::i18n::AdjustStringForLocaleDirection(&adjusted_string); |
- dlg_strings.append(adjusted_string); |
- dlg_strings.push_back('|'); |
- dlg_strings.append(ASCIIToUTF16( |
- base::i18n::IsRTL() ? env_vars::kRtlLocale : env_vars::kLtrLocale)); |
+// ChromeBrowserMainPartsWin --------------------------------------------------- |
- env->SetVar(env_vars::kRestartInfo, UTF16ToUTF8(dlg_strings)); |
+ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( |
+ const MainFunctionParams& parameters) |
+ : ChromeBrowserMainParts(parameters) { |
} |
-void RegisterApplicationRestart(const CommandLine& parsed_command_line) { |
- DCHECK(base::win::GetVersion() >= base::win::VERSION_VISTA); |
- base::ScopedNativeLibrary library(FilePath(L"kernel32.dll")); |
- // Get the function pointer for RegisterApplicationRestart. |
- RegisterApplicationRestartProc register_application_restart = |
- static_cast<RegisterApplicationRestartProc>( |
- library.GetFunctionPointer("RegisterApplicationRestart")); |
- if (!register_application_restart) { |
- LOG(WARNING) << "Cannot find RegisterApplicationRestart in kernel32.dll"; |
- return; |
- } |
- // The Windows Restart Manager expects a string of command line flags only, |
- // without the program. |
- CommandLine command_line(CommandLine::NO_PROGRAM); |
- command_line.AppendArguments(parsed_command_line, false); |
- if (!command_line.HasSwitch(switches::kRestoreLastSession)) |
- command_line.AppendSwitch(switches::kRestoreLastSession); |
- if (command_line.GetCommandLineString().length() > RESTART_MAX_CMD_LINE) { |
- LOG(WARNING) << "Command line too long for RegisterApplicationRestart"; |
- return; |
+void ChromeBrowserMainPartsWin::PreMainMessageLoopStart() { |
+ if (!parameters().ui_task) { |
+ // Make sure that we know how to handle exceptions from the message loop. |
+ InitializeWindowProcExceptions(); |
} |
+} |
- // Restart Chrome if the computer is restarted as the result of an update. |
- // This could be extended to handle crashes, hangs, and patches. |
- HRESULT hr = register_application_restart( |
- command_line.GetCommandLineString().c_str(), |
- RESTART_NO_CRASH | RESTART_NO_HANG | RESTART_NO_PATCH); |
- DCHECK(SUCCEEDED(hr)) << "RegisterApplicationRestart failed."; |
+void ChromeBrowserMainPartsWin::ShowMissingLocaleMessageBox() { |
+ ui::MessageBox(NULL, ASCIIToUTF16(chrome_browser::kMissingLocaleDataMessage), |
+ ASCIIToUTF16(chrome_browser::kMissingLocaleDataTitle), |
+ MB_OK | MB_ICONERROR | MB_TOPMOST); |
} |
// This method handles the --hide-icons and --show-icons command line options |
// for chrome that get triggered by Windows from registry entries |
// HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons |
// functionality so we just ask the users if they want to uninstall Chrome. |
-int HandleIconsCommands(const CommandLine& parsed_command_line) { |
- if (parsed_command_line.HasSwitch(switches::kHideIcons)) { |
+int ChromeBrowserMainPartsWin::HandleIconsCommands() { |
+ if (parsed_command_line().HasSwitch(switches::kHideIcons)) { |
string16 cp_applet; |
base::win::Version version = base::win::GetVersion(); |
if (version >= base::win::VERSION_VISTA) { |
@@ -241,7 +187,7 @@ int HandleIconsCommands(const CommandLine& parsed_command_line) { |
// machine. If yes and the current Chrome process is user level, we do not |
// allow the user level Chrome to run. So we notify the user and uninstall |
// user level Chrome. |
-bool CheckMachineLevelInstall() { |
+bool ChromeBrowserMainPartsWin::CheckMachineLevelInstall() { |
// TODO(tommi): Check if using the default distribution is always the right |
// thing to do. |
BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
@@ -271,16 +217,68 @@ bool CheckMachineLevelInstall() { |
return false; |
} |
-// ChromeBrowserMainPartsWin --------------------------------------------------- |
+// Prepares the localized strings that are going to be displayed to |
+// the user if the browser process dies. These strings are stored in the |
+// environment block so they are accessible in the early stages of the |
+// chrome executable's lifetime. |
+void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment() { |
+ // Clear this var so child processes don't show the dialog by default. |
+ scoped_ptr<base::Environment> env(base::Environment::Create()); |
+ env->UnSetVar(env_vars::kShowRestart); |
-ChromeBrowserMainPartsWin::ChromeBrowserMainPartsWin( |
- const MainFunctionParams& parameters) |
- : ChromeBrowserMainParts(parameters) { |
+ // For non-interactive tests we don't restart on crash. |
+ if (env->HasVar(env_vars::kHeadless)) |
+ return; |
+ |
+ // If the known command-line test options are used we don't create the |
+ // environment block which means we don't get the restart dialog. |
+ if (parsed_command_line().HasSwitch(switches::kBrowserCrashTest) || |
+ parsed_command_line().HasSwitch(switches::kBrowserAssertTest) || |
+ parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) |
+ return; |
+ |
+ // The encoding we use for the info is "title|context|direction" where |
+ // direction is either env_vars::kRtlLocale or env_vars::kLtrLocale depending |
+ // on the current locale. |
+ string16 dlg_strings(l10n_util::GetStringUTF16(IDS_CRASH_RECOVERY_TITLE)); |
+ dlg_strings.push_back('|'); |
+ string16 adjusted_string( |
+ l10n_util::GetStringUTF16(IDS_CRASH_RECOVERY_CONTENT)); |
+ base::i18n::AdjustStringForLocaleDirection(&adjusted_string); |
+ dlg_strings.append(adjusted_string); |
+ dlg_strings.push_back('|'); |
+ dlg_strings.append(ASCIIToUTF16( |
+ base::i18n::IsRTL() ? env_vars::kRtlLocale : env_vars::kLtrLocale)); |
+ |
+ env->SetVar(env_vars::kRestartInfo, UTF16ToUTF8(dlg_strings)); |
} |
-void ChromeBrowserMainPartsWin::PreMainMessageLoopStart() { |
- if (!parameters().ui_task) { |
- // Make sure that we know how to handle exceptions from the message loop. |
- InitializeWindowProcExceptions(); |
+void ChromeBrowserMainPartsWin::RegisterApplicationRestart() { |
+ DCHECK(base::win::GetVersion() >= base::win::VERSION_VISTA); |
+ base::ScopedNativeLibrary library(FilePath(L"kernel32.dll")); |
+ // Get the function pointer for RegisterApplicationRestart. |
+ RegisterApplicationRestartProc register_application_restart = |
+ static_cast<RegisterApplicationRestartProc>( |
+ library.GetFunctionPointer("RegisterApplicationRestart")); |
+ if (!register_application_restart) { |
+ LOG(WARNING) << "Cannot find RegisterApplicationRestart in kernel32.dll"; |
+ return; |
} |
+ // The Windows Restart Manager expects a string of command line flags only, |
+ // without the program. |
+ CommandLine command_line(CommandLine::NO_PROGRAM); |
+ command_line.AppendArguments(parsed_command_line(), false); |
+ if (!command_line.HasSwitch(switches::kRestoreLastSession)) |
+ command_line.AppendSwitch(switches::kRestoreLastSession); |
+ if (command_line.GetCommandLineString().length() > RESTART_MAX_CMD_LINE) { |
+ LOG(WARNING) << "Command line too long for RegisterApplicationRestart"; |
+ return; |
+ } |
+ |
+ // Restart Chrome if the computer is restarted as the result of an update. |
+ // This could be extended to handle crashes, hangs, and patches. |
+ HRESULT hr = register_application_restart( |
+ command_line.GetCommandLineString().c_str(), |
+ RESTART_NO_CRASH | RESTART_NO_HANG | RESTART_NO_PATCH); |
+ DCHECK(SUCCEEDED(hr)) << "RegisterApplicationRestart failed."; |
} |