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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser_main.h" 5 #include "chrome/browser/browser_main.h"
6 #include "chrome/browser/browser_main_win.h" 6 #include "chrome/browser/browser_main_win.h"
7 7
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 10
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 l10n_util::GetStringUTF16(IDS_CRASH_RECOVERY_CONTENT)); 139 l10n_util::GetStringUTF16(IDS_CRASH_RECOVERY_CONTENT));
140 base::i18n::AdjustStringForLocaleDirection(&adjusted_string); 140 base::i18n::AdjustStringForLocaleDirection(&adjusted_string);
141 dlg_strings.append(adjusted_string); 141 dlg_strings.append(adjusted_string);
142 dlg_strings.push_back('|'); 142 dlg_strings.push_back('|');
143 dlg_strings.append(ASCIIToUTF16( 143 dlg_strings.append(ASCIIToUTF16(
144 base::i18n::IsRTL() ? env_vars::kRtlLocale : env_vars::kLtrLocale)); 144 base::i18n::IsRTL() ? env_vars::kRtlLocale : env_vars::kLtrLocale));
145 145
146 env->SetVar(env_vars::kRestartInfo, UTF16ToUTF8(dlg_strings)); 146 env->SetVar(env_vars::kRestartInfo, UTF16ToUTF8(dlg_strings));
147 } 147 }
148 148
149 void RegisterApplicationRestart(const CommandLine &parsed_command_line) {
150 // 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.
151 CommandLine command_line(CommandLine::NO_PROGRAM);
152 command_line.AppendSwitches(parsed_command_line);
153 command_line.AppendArgs(parsed_command_line);
154 // Ensure restore last session is set.
155 if (!command_line.HasSwitch(switches::kRestoreLastSession))
156 command_line.AppendSwitch(switches::kRestoreLastSession);
157 PCWSTR command_line_string = command_line.command_line_string().c_str();
158 // Restart Chrome if the computer is restarted as the result of an update.
159 // This could be extended to handle crashes, hangs, and patches.
160 HRESULT hr = ::RegisterApplicationRestart(command_line_string,
161 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
162 DCHECK(SUCCEEDED(hr)) << "RegisterApplicationRestart failed.";
163 }
164
149 // This method handles the --hide-icons and --show-icons command line options 165 // This method handles the --hide-icons and --show-icons command line options
150 // for chrome that get triggered by Windows from registry entries 166 // for chrome that get triggered by Windows from registry entries
151 // HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons 167 // HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons
152 // functionality so we just ask the users if they want to uninstall Chrome. 168 // functionality so we just ask the users if they want to uninstall Chrome.
153 int HandleIconsCommands(const CommandLine &parsed_command_line) { 169 int HandleIconsCommands(const CommandLine &parsed_command_line) {
154 if (parsed_command_line.HasSwitch(switches::kHideIcons)) { 170 if (parsed_command_line.HasSwitch(switches::kHideIcons)) {
155 string16 cp_applet; 171 string16 cp_applet;
156 base::win::Version version = base::win::GetVersion(); 172 base::win::Version version = base::win::GetVersion();
157 if (version >= base::win::VERSION_VISTA) { 173 if (version >= base::win::VERSION_VISTA) {
158 cp_applet.assign(L"Programs and Features"); // Windows Vista and later. 174 cp_applet.assign(L"Programs and Features"); // Windows Vista and later.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 base::EnsureNSPRInit(); 261 base::EnsureNSPRInit();
246 } 262 }
247 } 263 }
248 }; 264 };
249 265
250 // static 266 // static
251 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( 267 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts(
252 const MainFunctionParams& parameters) { 268 const MainFunctionParams& parameters) {
253 return new BrowserMainPartsWin(parameters); 269 return new BrowserMainPartsWin(parameters);
254 } 270 }
OLDNEW
« 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