Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 string16 adjusted_string( | 138 string16 adjusted_string( |
| 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 |
|
cpu_(ooo_6.6-7.5)
2011/02/10 18:59:24
why not return bool ?
msw
2011/02/10 19:54:54
Done.
| |
| 149 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.
| |
| 150 // The Windows Restart Manager expects a string of command line flags only, | |
| 151 // without the program. | |
| 152 CommandLine command_line(CommandLine::NO_PROGRAM); | |
| 153 command_line.AppendSwitches(parsed_command_line); | |
| 154 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
| |
| 155 // Ensure restore last session is set. | |
| 156 if (!command_line.HasSwitch(switches::kRestoreLastSession)) | |
| 157 command_line.AppendSwitch(switches::kRestoreLastSession); | |
| 158 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.
| |
| 159 // Restart Chrome if the computer is restarted as the result of an update. | |
| 160 // This could be extended to handle crashes, hangs, and patches. | |
| 161 HRESULT hr = ::RegisterApplicationRestart(command_line_string, | |
| 162 RESTART_NO_CRASH | RESTART_NO_HANG | RESTART_NO_PATCH); | |
| 163 DCHECK(SUCCEEDED(hr)) << "RegisterApplicationRestart failed."; | |
| 164 } | |
| 165 | |
| 149 // This method handles the --hide-icons and --show-icons command line options | 166 // This method handles the --hide-icons and --show-icons command line options |
| 150 // for chrome that get triggered by Windows from registry entries | 167 // for chrome that get triggered by Windows from registry entries |
| 151 // HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons | 168 // HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons |
| 152 // functionality so we just ask the users if they want to uninstall Chrome. | 169 // functionality so we just ask the users if they want to uninstall Chrome. |
| 153 int HandleIconsCommands(const CommandLine &parsed_command_line) { | 170 int HandleIconsCommands(const CommandLine &parsed_command_line) { |
| 154 if (parsed_command_line.HasSwitch(switches::kHideIcons)) { | 171 if (parsed_command_line.HasSwitch(switches::kHideIcons)) { |
| 155 string16 cp_applet; | 172 string16 cp_applet; |
| 156 base::win::Version version = base::win::GetVersion(); | 173 base::win::Version version = base::win::GetVersion(); |
| 157 if (version >= base::win::VERSION_VISTA) { | 174 if (version >= base::win::VERSION_VISTA) { |
| 158 cp_applet.assign(L"Programs and Features"); // Windows Vista and later. | 175 cp_applet.assign(L"Programs and Features"); // Windows Vista and later. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 base::EnsureNSPRInit(); | 262 base::EnsureNSPRInit(); |
| 246 } | 263 } |
| 247 } | 264 } |
| 248 }; | 265 }; |
| 249 | 266 |
| 250 // static | 267 // static |
| 251 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( | 268 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( |
| 252 const MainFunctionParams& parameters) { | 269 const MainFunctionParams& parameters) { |
| 253 return new BrowserMainPartsWin(parameters); | 270 return new BrowserMainPartsWin(parameters); |
| 254 } | 271 } |
| OLD | NEW |