OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file defines the methods useful for uninstalling Chrome. | 5 // This file defines the methods useful for uninstalling Chrome. |
6 | 6 |
7 #include "chrome/installer/setup/uninstall.h" | 7 #include "chrome/installer/setup/uninstall.h" |
8 | 8 |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 void CloseAllChromeProcesses() { | 180 void CloseAllChromeProcesses() { |
181 for (int j = 0; j < 4; ++j) { | 181 for (int j = 0; j < 4; ++j) { |
182 string16 wnd_class(L"Chrome_WidgetWin_"); | 182 string16 wnd_class(L"Chrome_WidgetWin_"); |
183 wnd_class.append(base::IntToString16(j)); | 183 wnd_class.append(base::IntToString16(j)); |
184 HWND window = FindWindowEx(NULL, NULL, wnd_class.c_str(), NULL); | 184 HWND window = FindWindowEx(NULL, NULL, wnd_class.c_str(), NULL); |
185 while (window) { | 185 while (window) { |
186 HWND tmpWnd = window; | 186 HWND tmpWnd = window; |
187 window = FindWindowEx(NULL, window, wnd_class.c_str(), NULL); | 187 window = FindWindowEx(NULL, window, wnd_class.c_str(), NULL); |
188 if (!SendMessageTimeout(tmpWnd, WM_CLOSE, 0, 0, SMTO_BLOCK, 3000, NULL) && | 188 if (!SendMessageTimeout(tmpWnd, WM_CLOSE, 0, 0, SMTO_BLOCK, 3000, NULL) && |
189 (GetLastError() == ERROR_TIMEOUT)) { | 189 (GetLastError() == ERROR_TIMEOUT)) { |
190 base::CleanupProcesses(installer::kChromeExe, 0, | 190 base::CleanupProcesses(installer::kChromeExe, base::TimeDelta(), |
191 content::RESULT_CODE_HUNG, NULL); | 191 content::RESULT_CODE_HUNG, NULL); |
192 base::CleanupProcesses(installer::kNaClExe, 0, | 192 base::CleanupProcesses(installer::kNaClExe, base::TimeDelta(), |
193 content::RESULT_CODE_HUNG, NULL); | 193 content::RESULT_CODE_HUNG, NULL); |
194 return; | 194 return; |
195 } | 195 } |
196 } | 196 } |
197 } | 197 } |
198 | 198 |
199 // If asking politely didn't work, wait for 15 seconds and then kill all | 199 // If asking politely didn't work, wait for 15 seconds and then kill all |
200 // chrome.exe. This check is just in case Chrome is ignoring WM_CLOSE | 200 // chrome.exe. This check is just in case Chrome is ignoring WM_CLOSE |
201 // messages. | 201 // messages. |
202 base::CleanupProcesses(installer::kChromeExe, 15000, | 202 base::CleanupProcesses(installer::kChromeExe, |
| 203 base::TimeDelta::FromSeconds(15), |
203 content::RESULT_CODE_HUNG, NULL); | 204 content::RESULT_CODE_HUNG, NULL); |
204 base::CleanupProcesses(installer::kNaClExe, 15000, | 205 base::CleanupProcesses(installer::kNaClExe, |
| 206 base::TimeDelta::FromSeconds(15), |
205 content::RESULT_CODE_HUNG, NULL); | 207 content::RESULT_CODE_HUNG, NULL); |
206 } | 208 } |
207 | 209 |
208 // Attempts to close the Chrome Frame helper process by sending WM_CLOSE | 210 // Attempts to close the Chrome Frame helper process by sending WM_CLOSE |
209 // messages to its window, or just killing it if that doesn't work. | 211 // messages to its window, or just killing it if that doesn't work. |
210 void CloseChromeFrameHelperProcess() { | 212 void CloseChromeFrameHelperProcess() { |
211 HWND window = FindWindow(installer::kChromeFrameHelperWndClass, NULL); | 213 HWND window = FindWindow(installer::kChromeFrameHelperWndClass, NULL); |
212 if (!::IsWindow(window)) | 214 if (!::IsWindow(window)) |
213 return; | 215 return; |
214 | 216 |
(...skipping 14 matching lines...) Expand all Loading... |
229 LOG(WARNING) << "Wait for " << installer::kChromeFrameHelperExe | 231 LOG(WARNING) << "Wait for " << installer::kChromeFrameHelperExe |
230 << " to exit failed or timed out."; | 232 << " to exit failed or timed out."; |
231 } else { | 233 } else { |
232 kill = false; | 234 kill = false; |
233 VLOG(1) << installer::kChromeFrameHelperExe << " exited normally."; | 235 VLOG(1) << installer::kChromeFrameHelperExe << " exited normally."; |
234 } | 236 } |
235 } | 237 } |
236 | 238 |
237 if (kill) { | 239 if (kill) { |
238 VLOG(1) << installer::kChromeFrameHelperExe << " hung. Killing."; | 240 VLOG(1) << installer::kChromeFrameHelperExe << " hung. Killing."; |
239 base::CleanupProcesses(installer::kChromeFrameHelperExe, 0, | 241 base::CleanupProcesses(installer::kChromeFrameHelperExe, base::TimeDelta(), |
240 content::RESULT_CODE_HUNG, NULL); | 242 content::RESULT_CODE_HUNG, NULL); |
241 } | 243 } |
242 } | 244 } |
243 | 245 |
244 // This method deletes Chrome shortcut folder from Windows Start menu. It | 246 // This method deletes Chrome shortcut folder from Windows Start menu. It |
245 // checks system_uninstall to see if the shortcut is in all users start menu | 247 // checks system_uninstall to see if the shortcut is in all users start menu |
246 // or current user start menu. | 248 // or current user start menu. |
247 // We try to remove the standard desktop shortcut but if that fails we try | 249 // We try to remove the standard desktop shortcut but if that fails we try |
248 // to remove the alternate desktop shortcut. Only one of them should be | 250 // to remove the alternate desktop shortcut. Only one of them should be |
249 // present in a given install but at this point we don't know which one. | 251 // present in a given install but at this point we don't know which one. |
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 | 1137 |
1136 // Try and delete the preserved local state once the post-install | 1138 // Try and delete the preserved local state once the post-install |
1137 // operations are complete. | 1139 // operations are complete. |
1138 if (!backup_state_file.empty()) | 1140 if (!backup_state_file.empty()) |
1139 file_util::Delete(backup_state_file, false); | 1141 file_util::Delete(backup_state_file, false); |
1140 | 1142 |
1141 return ret; | 1143 return ret; |
1142 } | 1144 } |
1143 | 1145 |
1144 } // namespace installer | 1146 } // namespace installer |
OLD | NEW |