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 // 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" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // This method tries to figure out if current user has registered Chrome. | 173 // This method tries to figure out if current user has registered Chrome. |
174 // It returns true iff: | 174 // It returns true iff: |
175 // - Software\Clients\StartMenuInternet\Chromium\"" key has a valid value. | 175 // - Software\Clients\StartMenuInternet\Chromium\"" key has a valid value. |
176 // - The value is same as chrome.exe path for the current installation. | 176 // - The value is same as chrome.exe path for the current installation. |
177 bool CurrentUserHasDefaultBrowser(const Product& product) { | 177 bool CurrentUserHasDefaultBrowser(const Product& product) { |
178 std::wstring reg_key(ShellUtil::kRegStartMenuInternet); | 178 std::wstring reg_key(ShellUtil::kRegStartMenuInternet); |
179 reg_key.append(L"\\" + product.distribution()->GetApplicationName() + | 179 reg_key.append(L"\\" + product.distribution()->GetApplicationName() + |
180 ShellUtil::kRegShellOpen); | 180 ShellUtil::kRegShellOpen); |
181 RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_READ); | 181 RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_READ); |
182 std::wstring reg_exe; | 182 std::wstring reg_exe; |
183 if (key.ReadValue(L"", ®_exe) && reg_exe.length() > 2) { | 183 if (key.ReadValue(L"", ®_exe) == ERROR_SUCCESS && reg_exe.length() > 2) { |
184 FilePath chrome_exe(product.package().path() | 184 FilePath chrome_exe(product.package().path() |
185 .Append(installer::kChromeExe)); | 185 .Append(installer::kChromeExe)); |
186 // The path in the registry will always have quotes. | 186 // The path in the registry will always have quotes. |
187 reg_exe = reg_exe.substr(1, reg_exe.length() - 2); | 187 reg_exe = reg_exe.substr(1, reg_exe.length() - 2); |
188 if (FilePath::CompareEqualIgnoreCase(reg_exe, chrome_exe.value())) | 188 if (FilePath::CompareEqualIgnoreCase(reg_exe, chrome_exe.value())) |
189 return true; | 189 return true; |
190 } | 190 } |
191 | 191 |
192 return false; | 192 return false; |
193 } | 193 } |
(...skipping 562 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 |