| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 // This method tries to figure out if current user has registered Chrome. | 67 // This method tries to figure out if current user has registered Chrome. |
| 68 // It returns true iff: | 68 // It returns true iff: |
| 69 // - Software\Clients\StartMenuInternet\Chromium\"" key has a valid value. | 69 // - Software\Clients\StartMenuInternet\Chromium\"" key has a valid value. |
| 70 // - The value is same as chrome.exe path for the current installation. | 70 // - The value is same as chrome.exe path for the current installation. |
| 71 bool CurrentUserHasDefaultBrowser(bool system_uninstall) { | 71 bool CurrentUserHasDefaultBrowser(bool system_uninstall) { |
| 72 std::wstring reg_key(ShellUtil::kRegStartMenuInternet); | 72 std::wstring reg_key(ShellUtil::kRegStartMenuInternet); |
| 73 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 73 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 74 reg_key.append(L"\\" + dist->GetApplicationName() + ShellUtil::kRegShellOpen); | 74 reg_key.append(L"\\" + dist->GetApplicationName() + ShellUtil::kRegShellOpen); |
| 75 RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str()); | 75 RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_READ); |
| 76 std::wstring reg_exe; | 76 std::wstring reg_exe; |
| 77 if (key.ReadValue(L"", ®_exe) && reg_exe.length() > 2) { | 77 if (key.ReadValue(L"", ®_exe) && reg_exe.length() > 2) { |
| 78 std::wstring chrome_exe = installer::GetChromeInstallPath(system_uninstall); | 78 std::wstring chrome_exe = installer::GetChromeInstallPath(system_uninstall); |
| 79 file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); | 79 file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); |
| 80 reg_exe = reg_exe.substr(1, reg_exe.length() - 2); | 80 reg_exe = reg_exe.substr(1, reg_exe.length() - 2); |
| 81 if ((reg_exe.size() == chrome_exe.size()) && | 81 if ((reg_exe.size() == chrome_exe.size()) && |
| 82 (std::equal(chrome_exe.begin(), chrome_exe.end(), | 82 (std::equal(chrome_exe.begin(), chrome_exe.end(), |
| 83 reg_exe.begin(), CaseInsensitiveCompare<wchar_t>()))) | 83 reg_exe.begin(), CaseInsensitiveCompare<wchar_t>()))) |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 distribution_data); | 570 distribution_data); |
| 571 } | 571 } |
| 572 | 572 |
| 573 // Try and delete the preserved local state once the post-install | 573 // Try and delete the preserved local state once the post-install |
| 574 // operations are complete. | 574 // operations are complete. |
| 575 if (!local_state_path.empty()) | 575 if (!local_state_path.empty()) |
| 576 file_util::Delete(local_state_path, false); | 576 file_util::Delete(local_state_path, false); |
| 577 | 577 |
| 578 return ret; | 578 return ret; |
| 579 } | 579 } |
| OLD | NEW |