Index: chrome/browser/browser_main_win.cc |
diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc |
index 6616894cb9000ac82fc79d0c13d9cbc1f54bc9c4..4d839a2855917732980ec3ad84c9d7cebf6ccba3 100644 |
--- a/chrome/browser/browser_main_win.cc |
+++ b/chrome/browser/browser_main_win.cc |
@@ -146,6 +146,23 @@ void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) { |
env->SetVar(env_vars::kRestartInfo, UTF16ToUTF8(dlg_strings)); |
} |
cpu_(ooo_6.6-7.5)
2011/02/10 18:59:24
why not return bool ?
msw
2011/02/10 19:54:54
Done.
|
+void RegisterApplicationRestart(const CommandLine &parsed_command_line) { |
Evan Martin
2011/02/10 19:38:31
& on the left of the space
msw
2011/02/10 19:54:54
Done. Also fixed other instances in this file.
|
+ // The Windows Restart Manager expects a string of command line flags only, |
+ // without the program. |
+ CommandLine command_line(CommandLine::NO_PROGRAM); |
+ command_line.AppendSwitches(parsed_command_line); |
+ command_line.AppendArgs(parsed_command_line); |
Evan Martin
2011/02/10 19:38:31
I wonder if, rather than adding these extra APIs,
msw
2011/02/10 19:54:54
Yes, I propose to fix and cleanup CommandLine code
msw
2011/02/16 23:15:53
I'll follow up on the extensive amount of needed C
|
+ // Ensure restore last session is set. |
+ if (!command_line.HasSwitch(switches::kRestoreLastSession)) |
+ command_line.AppendSwitch(switches::kRestoreLastSession); |
+ PCWSTR command_line_string = command_line.command_line_string().c_str(); |
cpu_(ooo_6.6-7.5)
2011/02/10 18:59:24
we don't use PCWSTR replace with const wchar_t*
msw
2011/02/10 19:54:54
Done.
|
+ // 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 = ::RegisterApplicationRestart(command_line_string, |
+ RESTART_NO_CRASH | RESTART_NO_HANG | RESTART_NO_PATCH); |
+ DCHECK(SUCCEEDED(hr)) << "RegisterApplicationRestart failed."; |
+} |
+ |
// 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 |