| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // This method tries to figure out if current user has registered Chrome. | 174 // This method tries to figure out if current user has registered Chrome. |
| 175 // It returns true iff: | 175 // It returns true iff: |
| 176 // - Software\Clients\StartMenuInternet\Chromium\"" key has a valid value. | 176 // - Software\Clients\StartMenuInternet\Chromium\"" key has a valid value. |
| 177 // - The value is same as chrome.exe path for the current installation. | 177 // - The value is same as chrome.exe path for the current installation. |
| 178 bool CurrentUserHasDefaultBrowser(const Product& product) { | 178 bool CurrentUserHasDefaultBrowser(const Product& product) { |
| 179 std::wstring reg_key(ShellUtil::kRegStartMenuInternet); | 179 std::wstring reg_key(ShellUtil::kRegStartMenuInternet); |
| 180 reg_key.append(L"\\" + product.distribution()->GetApplicationName() + | 180 reg_key.append(L"\\" + product.distribution()->GetApplicationName() + |
| 181 ShellUtil::kRegShellOpen); | 181 ShellUtil::kRegShellOpen); |
| 182 RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_READ); | 182 RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_READ); |
| 183 std::wstring reg_exe; | 183 std::wstring reg_exe; |
| 184 if (key.ReadValue(L"", ®_exe) && reg_exe.length() > 2) { | 184 if (key.ReadValue(L"", ®_exe) == ERROR_SUCCESS && reg_exe.length() > 2) { |
| 185 FilePath chrome_exe(product.package().path() | 185 FilePath chrome_exe(product.package().path() |
| 186 .Append(installer::kChromeExe)); | 186 .Append(installer::kChromeExe)); |
| 187 // The path in the registry will always have quotes. | 187 // The path in the registry will always have quotes. |
| 188 reg_exe = reg_exe.substr(1, reg_exe.length() - 2); | 188 reg_exe = reg_exe.substr(1, reg_exe.length() - 2); |
| 189 if (FilePath::CompareEqualIgnoreCase(reg_exe, chrome_exe.value())) | 189 if (FilePath::CompareEqualIgnoreCase(reg_exe, chrome_exe.value())) |
| 190 return true; | 190 return true; |
| 191 } | 191 } |
| 192 | 192 |
| 193 return false; | 193 return false; |
| 194 } | 194 } |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 // Try and delete the preserved local state once the post-install | 757 // Try and delete the preserved local state once the post-install |
| 758 // operations are complete. | 758 // operations are complete. |
| 759 if (!backup_state_file.empty()) | 759 if (!backup_state_file.empty()) |
| 760 file_util::Delete(backup_state_file, false); | 760 file_util::Delete(backup_state_file, false); |
| 761 | 761 |
| 762 return ret; | 762 return ret; |
| 763 } | 763 } |
| 764 | 764 |
| 765 } // namespace installer | 765 } // namespace installer |
| 766 | 766 |
| OLD | NEW |