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

Unified Diff: chrome/browser/browser_main_win.cc

Issue 6462024: Register Application Restart with Windows Restart Manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "Update comment." Created 9 years, 10 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
« chrome/browser/browser_main_win.h ('K') | « chrome/browser/browser_main_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..00b648225e04e1a86c6a0a55827fbb23988a0b4d 100644
--- a/chrome/browser/browser_main_win.cc
+++ b/chrome/browser/browser_main_win.cc
@@ -146,6 +146,22 @@ void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) {
env->SetVar(env_vars::kRestartInfo, UTF16ToUTF8(dlg_strings));
}
+void RegisterApplicationRestart(const CommandLine &parsed_command_line) {
+ // Rebuild the CommandLine without the program for Windows Restart Manager.
Ben Goodger (Google) 2011/02/10 16:56:49 Rather than say what the code does, say why, e.g.
msw 2011/02/10 18:35:06 Done.
+ CommandLine command_line(CommandLine::NO_PROGRAM);
+ command_line.AppendSwitches(parsed_command_line);
+ command_line.AppendArgs(parsed_command_line);
+ // 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();
+ // 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);
Ben Goodger (Google) 2011/02/10 16:56:49 I am OK with this if cpu is OK :-)
msw 2011/02/10 18:35:06 Yeah, we may want to handle crashes, hangs, and pa
+ 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
« chrome/browser/browser_main_win.h ('K') | « chrome/browser/browser_main_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698