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

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

Issue 10912096: C++ reability review for gab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix up last backward if else block found with regex('if \(.* != .*\) \{(\n[^}]*)*\} else') Created 8 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 //Pickup file for readability review.
8
7 #include "chrome/installer/setup/uninstall.h" 9 #include "chrome/installer/setup/uninstall.h"
8 10
9 #include <windows.h> 11 #include <windows.h>
10 12
11 #include <vector> 13 #include <vector>
12 14
13 #include "base/file_util.h" 15 #include "base/file_util.h"
14 #include "base/path_service.h" 16 #include "base/path_service.h"
15 #include "base/process_util.h" 17 #include "base/process_util.h"
16 #include "base/string16.h" 18 #include "base/string16.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 bool success = update_list->Do(); 127 bool success = update_list->Do();
126 LOG_IF(ERROR, !success) << "Failed updating channel values."; 128 LOG_IF(ERROR, !success) << "Failed updating channel values.";
127 } 129 }
128 } 130 }
129 131
130 void ProcessOnOsUpgradeWorkItems( 132 void ProcessOnOsUpgradeWorkItems(
131 const installer::InstallerState& installer_state, 133 const installer::InstallerState& installer_state,
132 const installer::Product& product) { 134 const installer::Product& product) {
133 scoped_ptr<WorkItemList> work_item_list( 135 scoped_ptr<WorkItemList> work_item_list(
134 WorkItem::CreateNoRollbackWorkItemList()); 136 WorkItem::CreateNoRollbackWorkItemList());
135 AddOsUpgradeWorkItems(installer_state, NULL, NULL, product, 137 AddOsUpgradeWorkItems(installer_state, FilePath(), Version(), product,
136 work_item_list.get()); 138 work_item_list.get());
137 if (!work_item_list->Do()) 139 if (!work_item_list->Do())
138 LOG(ERROR) << "Failed to remove on-os-upgrade command."; 140 LOG(ERROR) << "Failed to remove on-os-upgrade command.";
139 } 141 }
140 142
141 // Adds or removes the quick-enable-cf command to the binaries' version key in 143 // Adds or removes the quick-enable-cf command to the binaries' version key in
142 // the registry as needed. 144 // the registry as needed.
143 void ProcessQuickEnableWorkItems( 145 void ProcessQuickEnableWorkItems(
144 const installer::InstallerState& installer_state, 146 const installer::InstallerState& installer_state,
145 const installer::InstallationState& machine_state) { 147 const installer::InstallationState& machine_state) {
146 scoped_ptr<WorkItemList> work_item_list( 148 scoped_ptr<WorkItemList> work_item_list(
147 WorkItem::CreateNoRollbackWorkItemList()); 149 WorkItem::CreateNoRollbackWorkItemList());
148 150
149 AddQuickEnableChromeFrameWorkItems(installer_state, machine_state, NULL, NULL, 151 AddQuickEnableChromeFrameWorkItems(installer_state, machine_state, FilePath(),
150 work_item_list.get()); 152 Version(), work_item_list.get());
151 153
152 AddQuickEnableApplicationHostWorkItems(installer_state, machine_state, NULL, 154 AddQuickEnableApplicationHostWorkItems(installer_state, machine_state,
153 NULL, work_item_list.get()); 155 FilePath(), Version(),
156 work_item_list.get());
154 if (!work_item_list->Do()) 157 if (!work_item_list->Do())
155 LOG(ERROR) << "Failed to update quick-enable-cf command."; 158 LOG(ERROR) << "Failed to update quick-enable-cf command.";
156 } 159 }
157 160
158 void ProcessIELowRightsPolicyWorkItems( 161 void ProcessIELowRightsPolicyWorkItems(
159 const installer::InstallerState& installer_state) { 162 const installer::InstallerState& installer_state) {
160 scoped_ptr<WorkItemList> work_items(WorkItem::CreateNoRollbackWorkItemList()); 163 scoped_ptr<WorkItemList> work_items(WorkItem::CreateNoRollbackWorkItemList());
161 AddDeleteOldIELowRightsPolicyWorkItems(installer_state, work_items.get()); 164 AddDeleteOldIELowRightsPolicyWorkItems(installer_state, work_items.get());
162 work_items->Do(); 165 work_items->Do();
163 installer::RefreshElevationPolicy(); 166 installer::RefreshElevationPolicy();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 if (!ShellUtil::RemoveChromeDesktopShortcut( 279 if (!ShellUtil::RemoveChromeDesktopShortcut(
277 product.distribution(), 280 product.distribution(),
278 ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL, 281 ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL,
279 ShellUtil::SHORTCUT_NO_OPTIONS)) { 282 ShellUtil::SHORTCUT_NO_OPTIONS)) {
280 ShellUtil::RemoveChromeDesktopShortcut( 283 ShellUtil::RemoveChromeDesktopShortcut(
281 product.distribution(), 284 product.distribution(),
282 ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL, 285 ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL,
283 ShellUtil::SHORTCUT_ALTERNATE); 286 ShellUtil::SHORTCUT_ALTERNATE);
284 } 287 }
285 288
286 ShellUtil::RemoveChromeQuickLaunchShortcut(product.distribution(), 289 ShellUtil::RemoveChromeQuickLaunchShortcut(
290 product.distribution(),
287 ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL); 291 ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL);
288 } else { 292 } else {
289 PathService::Get(base::DIR_START_MENU, &shortcut_path); 293 PathService::Get(base::DIR_START_MENU, &shortcut_path);
290 if (!ShellUtil::RemoveChromeDesktopShortcut(product.distribution(), 294 if (!ShellUtil::RemoveChromeDesktopShortcut(
295 product.distribution(),
291 ShellUtil::CURRENT_USER, ShellUtil::SHORTCUT_NO_OPTIONS)) { 296 ShellUtil::CURRENT_USER, ShellUtil::SHORTCUT_NO_OPTIONS)) {
292 ShellUtil::RemoveChromeDesktopShortcut(product.distribution(), 297 ShellUtil::RemoveChromeDesktopShortcut(
298 product.distribution(),
293 ShellUtil::CURRENT_USER, ShellUtil::SHORTCUT_ALTERNATE); 299 ShellUtil::CURRENT_USER, ShellUtil::SHORTCUT_ALTERNATE);
294 } 300 }
295 301
296 ShellUtil::RemoveChromeQuickLaunchShortcut(product.distribution(), 302 ShellUtil::RemoveChromeQuickLaunchShortcut(
297 ShellUtil::CURRENT_USER); 303 product.distribution(), ShellUtil::CURRENT_USER);
298 } 304 }
299 if (shortcut_path.empty()) { 305 if (shortcut_path.empty()) {
300 LOG(ERROR) << "Failed to get location for shortcut."; 306 LOG(ERROR) << "Failed to get location for shortcut.";
301 } else { 307 } else {
302 const string16 product_name(product.distribution()->GetAppShortCutName()); 308 const string16 product_name(product.distribution()->GetAppShortCutName());
303 shortcut_path = shortcut_path.Append(product_name); 309 shortcut_path = shortcut_path.Append(product_name);
304 310
305 FilePath shortcut_link(shortcut_path.Append(product_name + L".lnk")); 311 FilePath shortcut_link(shortcut_path.Append(product_name + L".lnk"));
306 312
307 VLOG(1) << "Unpinning shortcut at " << shortcut_link.value() 313 VLOG(1) << "Unpinning shortcut at " << shortcut_link.value()
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 HKEY_USERS, 676 HKEY_USERS,
671 string16(L".DEFAULT\\").append( 677 string16(L".DEFAULT\\").append(
672 ShellUtil::kRegStartMenuInternet).c_str(), 678 ShellUtil::kRegStartMenuInternet).c_str(),
673 L"", InstallUtil::ValueEquals(client_name)); 679 L"", InstallUtil::ValueEquals(client_name));
674 } 680 }
675 } 681 }
676 } 682 }
677 } 683 }
678 684
679 // Delete Software\RegisteredApplications\Chromium 685 // Delete Software\RegisteredApplications\Chromium
680 InstallUtil::DeleteRegistryValue(root, ShellUtil::kRegRegisteredApplications, 686 InstallUtil::DeleteRegistryValue(
687 root, ShellUtil::kRegRegisteredApplications,
681 dist->GetBaseAppName() + browser_entry_suffix); 688 dist->GetBaseAppName() + browser_entry_suffix);
682 689
683 // Delete the App Paths and Applications keys that let Explorer find Chrome: 690 // Delete the App Paths and Applications keys that let Explorer find Chrome:
684 // http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121 691 // http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121
685 string16 app_key(ShellUtil::kRegClasses); 692 string16 app_key(ShellUtil::kRegClasses);
686 app_key.push_back(FilePath::kSeparators[0]); 693 app_key.push_back(FilePath::kSeparators[0]);
687 app_key.append(L"Applications"); 694 app_key.append(L"Applications");
688 app_key.push_back(FilePath::kSeparators[0]); 695 app_key.push_back(FilePath::kSeparators[0]);
689 app_key.append(installer::kChromeExe); 696 app_key.append(installer::kChromeExe);
690 InstallUtil::DeleteRegistryKey(root, app_key); 697 InstallUtil::DeleteRegistryKey(root, app_key);
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 1206
1200 // Try and delete the preserved local state once the post-install 1207 // Try and delete the preserved local state once the post-install
1201 // operations are complete. 1208 // operations are complete.
1202 if (!backup_state_file.empty()) 1209 if (!backup_state_file.empty())
1203 file_util::Delete(backup_state_file, false); 1210 file_util::Delete(backup_state_file, false);
1204 1211
1205 return ret; 1212 return ret;
1206 } 1213 }
1207 1214
1208 } // namespace installer 1215 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698