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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 HWND window = FindWindow(installer::kChromeFrameHelperWndClass, NULL); | 275 HWND window = FindWindow(installer::kChromeFrameHelperWndClass, NULL); |
276 if (!::IsWindow(window)) | 276 if (!::IsWindow(window)) |
277 return; | 277 return; |
278 | 278 |
279 const DWORD kWaitMs = 3000; | 279 const DWORD kWaitMs = 3000; |
280 | 280 |
281 DWORD pid = 0; | 281 DWORD pid = 0; |
282 ::GetWindowThreadProcessId(window, &pid); | 282 ::GetWindowThreadProcessId(window, &pid); |
283 DCHECK_NE(pid, 0U); | 283 DCHECK_NE(pid, 0U); |
284 base::win::ScopedHandle process(::OpenProcess(SYNCHRONIZE, FALSE, pid)); | 284 base::win::ScopedHandle process(::OpenProcess(SYNCHRONIZE, FALSE, pid)); |
285 PLOG_IF(INFO, !process) << "Failed to open process: " << pid; | 285 PLOG_IF(INFO, !process.IsValid()) << "Failed to open process: " << pid; |
286 | 286 |
287 bool kill = true; | 287 bool kill = true; |
288 if (SendMessageTimeout(window, WM_CLOSE, 0, 0, SMTO_BLOCK, kWaitMs, NULL) && | 288 if (SendMessageTimeout(window, WM_CLOSE, 0, 0, SMTO_BLOCK, kWaitMs, NULL) && |
289 process) { | 289 process.IsValid()) { |
290 VLOG(1) << "Waiting for " << installer::kChromeFrameHelperExe; | 290 VLOG(1) << "Waiting for " << installer::kChromeFrameHelperExe; |
291 DWORD wait = ::WaitForSingleObject(process, kWaitMs); | 291 DWORD wait = ::WaitForSingleObject(process.Get(), kWaitMs); |
292 if (wait != WAIT_OBJECT_0) { | 292 if (wait != WAIT_OBJECT_0) { |
293 LOG(WARNING) << "Wait for " << installer::kChromeFrameHelperExe | 293 LOG(WARNING) << "Wait for " << installer::kChromeFrameHelperExe |
294 << " to exit failed or timed out."; | 294 << " to exit failed or timed out."; |
295 } else { | 295 } else { |
296 kill = false; | 296 kill = false; |
297 VLOG(1) << installer::kChromeFrameHelperExe << " exited normally."; | 297 VLOG(1) << installer::kChromeFrameHelperExe << " exited normally."; |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
301 if (kill) { | 301 if (kill) { |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 // If we need a reboot to continue, schedule the parent directories for | 1467 // If we need a reboot to continue, schedule the parent directories for |
1468 // deletion unconditionally. If they are not empty, the session manager | 1468 // deletion unconditionally. If they are not empty, the session manager |
1469 // will not delete them on reboot. | 1469 // will not delete them on reboot. |
1470 ScheduleParentAndGrandparentForDeletion(target_path); | 1470 ScheduleParentAndGrandparentForDeletion(target_path); |
1471 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { | 1471 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { |
1472 *uninstall_status = UNINSTALL_FAILED; | 1472 *uninstall_status = UNINSTALL_FAILED; |
1473 } | 1473 } |
1474 } | 1474 } |
1475 | 1475 |
1476 } // namespace installer | 1476 } // namespace installer |
OLD | NEW |