OLD | NEW |
1 // Copyright (c) 2010 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 // 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 "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/scoped_handle.h" | |
12 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
13 #include "base/string_util.h" | 12 #include "base/string_util.h" |
14 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
15 #include "base/win/registry.h" | 14 #include "base/win/registry.h" |
| 15 #include "base/win/scoped_handle.h" |
16 #include "base/win/windows_version.h" | 16 #include "base/win/windows_version.h" |
17 #include "chrome/common/result_codes.h" | 17 #include "chrome/common/result_codes.h" |
18 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
19 #include "chrome/common/chrome_paths_internal.h" | 19 #include "chrome/common/chrome_paths_internal.h" |
20 #include "chrome/installer/setup/install.h" | 20 #include "chrome/installer/setup/install.h" |
21 #include "chrome/installer/setup/setup_constants.h" | 21 #include "chrome/installer/setup/setup_constants.h" |
22 #include "chrome/installer/util/browser_distribution.h" | 22 #include "chrome/installer/util/browser_distribution.h" |
23 #include "chrome/installer/util/channel_info.h" | 23 #include "chrome/installer/util/channel_info.h" |
24 #include "chrome/installer/util/delete_after_reboot_helper.h" | 24 #include "chrome/installer/util/delete_after_reboot_helper.h" |
25 #include "chrome/installer/util/google_update_constants.h" | 25 #include "chrome/installer/util/google_update_constants.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 void CloseChromeFrameHelperProcess() { | 139 void CloseChromeFrameHelperProcess() { |
140 HWND window = FindWindow(installer::kChromeFrameHelperWndClass, NULL); | 140 HWND window = FindWindow(installer::kChromeFrameHelperWndClass, NULL); |
141 if (!::IsWindow(window)) | 141 if (!::IsWindow(window)) |
142 return; | 142 return; |
143 | 143 |
144 const DWORD kWaitMs = 3000; | 144 const DWORD kWaitMs = 3000; |
145 | 145 |
146 DWORD pid = 0; | 146 DWORD pid = 0; |
147 ::GetWindowThreadProcessId(window, &pid); | 147 ::GetWindowThreadProcessId(window, &pid); |
148 DCHECK_NE(pid, 0U); | 148 DCHECK_NE(pid, 0U); |
149 ScopedHandle process(::OpenProcess(SYNCHRONIZE, FALSE, pid)); | 149 base::win::ScopedHandle process(::OpenProcess(SYNCHRONIZE, FALSE, pid)); |
150 PLOG_IF(INFO, !process) << "Failed to open process: " << pid; | 150 PLOG_IF(INFO, !process) << "Failed to open process: " << pid; |
151 | 151 |
152 bool kill = true; | 152 bool kill = true; |
153 if (SendMessageTimeout(window, WM_CLOSE, 0, 0, SMTO_BLOCK, kWaitMs, NULL) && | 153 if (SendMessageTimeout(window, WM_CLOSE, 0, 0, SMTO_BLOCK, kWaitMs, NULL) && |
154 process) { | 154 process) { |
155 VLOG(1) << "Waiting for " << installer::kChromeFrameHelperExe; | 155 VLOG(1) << "Waiting for " << installer::kChromeFrameHelperExe; |
156 DWORD wait = ::WaitForSingleObject(process, kWaitMs); | 156 DWORD wait = ::WaitForSingleObject(process, kWaitMs); |
157 if (wait != WAIT_OBJECT_0) { | 157 if (wait != WAIT_OBJECT_0) { |
158 LOG(WARNING) << "Wait for " << installer::kChromeFrameHelperExe | 158 LOG(WARNING) << "Wait for " << installer::kChromeFrameHelperExe |
159 << " to exit failed or timed out."; | 159 << " to exit failed or timed out."; |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 // Try and delete the preserved local state once the post-install | 756 // Try and delete the preserved local state once the post-install |
757 // operations are complete. | 757 // operations are complete. |
758 if (!backup_state_file.empty()) | 758 if (!backup_state_file.empty()) |
759 file_util::Delete(backup_state_file, false); | 759 file_util::Delete(backup_state_file, false); |
760 | 760 |
761 return ret; | 761 return ret; |
762 } | 762 } |
763 | 763 |
764 } // namespace installer | 764 } // namespace installer |
765 | 765 |
OLD | NEW |