| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/common/win_util.h" | 5 #include "chrome/common/win_util.h" |
| 6 | 6 |
| 7 #include <shellapi.h> | 7 #include <shellapi.h> |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include "chrome/browser/browser_main_win.h" | 10 #include "chrome/browser/browser_main_win.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 ::SetEnvironmentVariableW(env_vars::kRestartInfo, dlg_strings.c_str()); | 106 ::SetEnvironmentVariableW(env_vars::kRestartInfo, dlg_strings.c_str()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 // This method handles the --hide-icons and --show-icons command line options | 109 // This method handles the --hide-icons and --show-icons command line options |
| 110 // for chrome that get triggered by Windows from registry entries | 110 // for chrome that get triggered by Windows from registry entries |
| 111 // HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons | 111 // HideIconsCommand & ShowIconsCommand. Chrome doesn't support hide icons |
| 112 // functionality so we just ask the users if they want to uninstall Chrome. | 112 // functionality so we just ask the users if they want to uninstall Chrome. |
| 113 int HandleIconsCommands(const CommandLine &parsed_command_line) { | 113 int HandleIconsCommands(const CommandLine &parsed_command_line) { |
| 114 if (parsed_command_line.HasSwitch(switches::kHideIcons)) { | 114 if (parsed_command_line.HasSwitch(switches::kHideIcons)) { |
| 115 std::wstring cp_applet; | 115 std::wstring cp_applet; |
| 116 if (win_util::GetWinVersion() == win_util::WINVERSION_VISTA) { | 116 win_util::WinVersion version = win_util::GetWinVersion(); |
| 117 if (version >= win_util::WINVERSION_VISTA) { |
| 117 cp_applet.assign(L"Programs and Features"); // Windows Vista and later. | 118 cp_applet.assign(L"Programs and Features"); // Windows Vista and later. |
| 118 } else if (win_util::GetWinVersion() == win_util::WINVERSION_XP) { | 119 } else if (version >= win_util::WINVERSION_XP) { |
| 119 cp_applet.assign(L"Add/Remove Programs"); // Windows XP. | 120 cp_applet.assign(L"Add/Remove Programs"); // Windows XP. |
| 120 } else { | 121 } else { |
| 121 return ResultCodes::UNSUPPORTED_PARAM; // Not supported | 122 return ResultCodes::UNSUPPORTED_PARAM; // Not supported |
| 122 } | 123 } |
| 123 | 124 |
| 124 const std::wstring msg = l10n_util::GetStringF(IDS_HIDE_ICONS_NOT_SUPPORTED, | 125 const std::wstring msg = l10n_util::GetStringF(IDS_HIDE_ICONS_NOT_SUPPORTED, |
| 125 cp_applet); | 126 cp_applet); |
| 126 const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); | 127 const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME); |
| 127 const UINT flags = MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST; | 128 const UINT flags = MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST; |
| 128 if (IDOK == win_util::MessageBox(NULL, msg, caption, flags)) | 129 if (IDOK == win_util::MessageBox(NULL, msg, caption, flags)) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 180 |
| 180 // We record in UMA the conditions that can prevent breakpad from generating | 181 // We record in UMA the conditions that can prevent breakpad from generating |
| 181 // and sending crash reports. Namely that the crash reporting registration | 182 // and sending crash reports. Namely that the crash reporting registration |
| 182 // failed and that the process is being debugged. | 183 // failed and that the process is being debugged. |
| 183 void RecordBreakpadStatusUMA(MetricsService* metrics) { | 184 void RecordBreakpadStatusUMA(MetricsService* metrics) { |
| 184 DWORD len = ::GetEnvironmentVariableW(env_vars::kNoOOBreakpad, NULL, 0); | 185 DWORD len = ::GetEnvironmentVariableW(env_vars::kNoOOBreakpad, NULL, 0); |
| 185 metrics->RecordBreakpadRegistration((len == 0)); | 186 metrics->RecordBreakpadRegistration((len == 0)); |
| 186 metrics->RecordBreakpadHasDebugger(TRUE == ::IsDebuggerPresent()); | 187 metrics->RecordBreakpadHasDebugger(TRUE == ::IsDebuggerPresent()); |
| 187 } | 188 } |
| 188 | 189 |
| OLD | NEW |