Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: chrome/installer/setup/uninstall.cc

Issue 6090006: Regkey functions return error code instead of bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // This method tries to figure out if current user has registered Chrome. 108 // This method tries to figure out if current user has registered Chrome.
109 // It returns true iff: 109 // It returns true iff:
110 // - Software\Clients\StartMenuInternet\Chromium\"" key has a valid value. 110 // - Software\Clients\StartMenuInternet\Chromium\"" key has a valid value.
111 // - The value is same as chrome.exe path for the current installation. 111 // - The value is same as chrome.exe path for the current installation.
112 bool CurrentUserHasDefaultBrowser(const Product& product) { 112 bool CurrentUserHasDefaultBrowser(const Product& product) {
113 std::wstring reg_key(ShellUtil::kRegStartMenuInternet); 113 std::wstring reg_key(ShellUtil::kRegStartMenuInternet);
114 reg_key.append(L"\\" + product.distribution()->GetApplicationName() + 114 reg_key.append(L"\\" + product.distribution()->GetApplicationName() +
115 ShellUtil::kRegShellOpen); 115 ShellUtil::kRegShellOpen);
116 RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_READ); 116 RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_READ);
117 std::wstring reg_exe; 117 std::wstring reg_exe;
118 if (key.ReadValue(L"", &reg_exe) && reg_exe.length() > 2) { 118 if (key.ReadValue(L"", &reg_exe) == ERROR_SUCCESS && reg_exe.length() > 2) {
119 FilePath chrome_exe(product.package().path() 119 FilePath chrome_exe(product.package().path()
120 .Append(installer::kChromeExe)); 120 .Append(installer::kChromeExe));
121 // The path in the registry will always have quotes. 121 // The path in the registry will always have quotes.
122 reg_exe = reg_exe.substr(1, reg_exe.length() - 2); 122 reg_exe = reg_exe.substr(1, reg_exe.length() - 2);
123 if (FilePath::CompareEqualIgnoreCase(reg_exe, chrome_exe.value())) 123 if (FilePath::CompareEqualIgnoreCase(reg_exe, chrome_exe.value()))
124 return true; 124 return true;
125 } 125 }
126 126
127 return false; 127 return false;
128 } 128 }
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 // Try and delete the preserved local state once the post-install 674 // Try and delete the preserved local state once the post-install
675 // operations are complete. 675 // operations are complete.
676 if (!backup_state_file.empty()) 676 if (!backup_state_file.empty())
677 file_util::Delete(backup_state_file, false); 677 file_util::Delete(backup_state_file, false);
678 678
679 return ret; 679 return ret;
680 } 680 }
681 681
682 } // namespace installer 682 } // namespace installer
683 683
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698