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

Side by Side Diff: chrome/installer/setup/install.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) 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 #include "chrome/installer/setup/install.h" 5 #include "chrome/installer/setup/install.h"
6 6
7 #include <shlobj.h> 7 #include <shlobj.h>
8 #include <time.h> 8 #include <time.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 182
183 RegKey key; 183 RegKey key;
184 ChannelInfo other_info; 184 ChannelInfo other_info;
185 std::vector<std::wstring>::const_iterator kscan = keys.begin(); 185 std::vector<std::wstring>::const_iterator kscan = keys.begin();
186 std::vector<std::wstring>::const_iterator kend = keys.end(); 186 std::vector<std::wstring>::const_iterator kend = keys.end();
187 for (; kscan != kend; ++kscan) { 187 for (; kscan != kend; ++kscan) {
188 // Handle the case where the ClientState key doesn't exist by creating it. 188 // Handle the case where the ClientState key doesn't exist by creating it.
189 // This takes care of the multi-installer's package key, which is not 189 // This takes care of the multi-installer's package key, which is not
190 // created by Google Update for us. 190 // created by Google Update for us.
191 if (!key.Open(reg_root, kscan->c_str(), KEY_QUERY_VALUE) || 191 if (key.Open(reg_root, kscan->c_str(), KEY_QUERY_VALUE) != ERROR_SUCCESS ||
192 !other_info.Initialize(key)) { 192 !other_info.Initialize(key)) {
193 other_info.set_value(std::wstring()); 193 other_info.set_value(std::wstring());
194 } 194 }
195 if (!other_info.Equals(channel_info)) { 195 if (!other_info.Equals(channel_info)) {
196 if (!key.Valid()) 196 if (!key.Valid())
197 install_list->AddCreateRegKeyWorkItem(reg_root, *kscan); 197 install_list->AddCreateRegKeyWorkItem(reg_root, *kscan);
198 install_list->AddSetRegValueWorkItem(reg_root, *kscan, 198 install_list->AddSetRegValueWorkItem(reg_root, *kscan,
199 google_update::kRegApField, 199 google_update::kRegApField,
200 channel_info.value(), true); 200 channel_info.value(), true);
201 } 201 }
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 WorkItem::CreateConditionalWorkItemList( 537 WorkItem::CreateConditionalWorkItemList(
538 new Not(new ConditionRunIfFileExists(new_chrome_exe)))); 538 new Not(new ConditionRunIfFileExists(new_chrome_exe))));
539 regular_update_work_items->set_log_message( 539 regular_update_work_items->set_log_message(
540 "RegularUpdateWorkItemList"); 540 "RegularUpdateWorkItemList");
541 541
542 // Since this was not an in-use-update, delete 'opv' and 'cmd' keys. 542 // Since this was not an in-use-update, delete 'opv' and 'cmd' keys.
543 for (size_t i = 0; i < products.size(); ++i) { 543 for (size_t i = 0; i < products.size(); ++i) {
544 BrowserDistribution* dist = products[i]->distribution(); 544 BrowserDistribution* dist = products[i]->distribution();
545 std::wstring version_key(dist->GetVersionKey()); 545 std::wstring version_key(dist->GetVersionKey());
546 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, 546 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key,
547 google_update::kRegOldVersionField, 547 google_update::kRegOldVersionField);
548 REG_SZ);
549 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, 548 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key,
550 google_update::kRegRenameCmdField, 549 google_update::kRegRenameCmdField);
551 REG_SZ);
552 } 550 }
553 551
554 post_install_task_list->AddWorkItem(regular_update_work_items.release()); 552 post_install_task_list->AddWorkItem(regular_update_work_items.release());
555 } 553 }
556 554
557 AddRegisterComDllWorkItemsForPackage(package, current_version, new_version, 555 AddRegisterComDllWorkItemsForPackage(package, current_version, new_version,
558 post_install_task_list); 556 post_install_task_list);
559 557
560 for (size_t i = 0; i < products.size(); ++i) { 558 for (size_t i = 0; i < products.size(); ++i) {
561 const Product* product = products[i]; 559 const Product* product = products[i];
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 // installed with ready mode enabled (the --ready-mode switch should be set 1147 // installed with ready mode enabled (the --ready-mode switch should be set
1150 // in the registry) so deleting the value should have no effect. 1148 // in the registry) so deleting the value should have no effect.
1151 // In both cases (install/uninstall), we need to make sure that Chrome's 1149 // In both cases (install/uninstall), we need to make sure that Chrome's
1152 // uninstallation command line does not include the --chrome-frame switch 1150 // uninstallation command line does not include the --chrome-frame switch
1153 // so that uninstalling Chrome will no longer uninstall Chrome Frame. 1151 // so that uninstalling Chrome will no longer uninstall Chrome Frame.
1154 1152
1155 if (RegKey(root, product.package().properties()->GetStateKey().c_str(), 1153 if (RegKey(root, product.package().properties()->GetStateKey().c_str(),
1156 KEY_QUERY_VALUE).Valid()) { 1154 KEY_QUERY_VALUE).Valid()) {
1157 list->AddDeleteRegValueWorkItem(root, 1155 list->AddDeleteRegValueWorkItem(root,
1158 product.package().properties()->GetStateKey(), 1156 product.package().properties()->GetStateKey(),
1159 installer::kChromeFrameReadyModeField, REG_QWORD); 1157 installer::kChromeFrameReadyModeField);
1160 } 1158 }
1161 1159
1162 const Product* chrome = installer::FindProduct(product.package().products(), 1160 const Product* chrome = installer::FindProduct(product.package().products(),
1163 BrowserDistribution::CHROME_BROWSER); 1161 BrowserDistribution::CHROME_BROWSER);
1164 if (chrome) { 1162 if (chrome) {
1165 // Chrome is already a part of this installation run, so we can assume 1163 // Chrome is already a part of this installation run, so we can assume
1166 // that the uninstallation arguments will be updated correctly. 1164 // that the uninstallation arguments will be updated correctly.
1167 } else { 1165 } else {
1168 // Chrome is not a part of this installation run, so we have to explicitly 1166 // Chrome is not a part of this installation run, so we have to explicitly
1169 // check if Chrome is installed, and if so, update its uninstallation 1167 // check if Chrome is installed, and if so, update its uninstallation
1170 // command lines. 1168 // command lines.
1171 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( 1169 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution(
1172 BrowserDistribution::CHROME_BROWSER, 1170 BrowserDistribution::CHROME_BROWSER,
1173 MasterPreferences::ForCurrentProcess()); 1171 MasterPreferences::ForCurrentProcess());
1174 update_chrome_uninstall_command = 1172 update_chrome_uninstall_command =
1175 IsInstalledAsMulti(product.system_level(), dist); 1173 IsInstalledAsMulti(product.system_level(), dist);
1176 } 1174 }
1177 } 1175 }
1178 1176
1179 if (!ready_mode || !install) { 1177 if (!ready_mode || !install) {
1180 list->AddDeleteRegValueWorkItem(root, version_key, 1178 list->AddDeleteRegValueWorkItem(root, version_key,
1181 google_update::kRegCFTempOptOutCmdField, 1179 google_update::kRegCFTempOptOutCmdField);
1182 REG_SZ);
1183 list->AddDeleteRegValueWorkItem(root, version_key, 1180 list->AddDeleteRegValueWorkItem(root, version_key,
1184 google_update::kRegCFEndTempOptOutCmdField, 1181 google_update::kRegCFEndTempOptOutCmdField);
1185 REG_SZ);
1186 list->AddDeleteRegValueWorkItem(root, version_key, 1182 list->AddDeleteRegValueWorkItem(root, version_key,
1187 google_update::kRegCFOptOutCmdField, 1183 google_update::kRegCFOptOutCmdField);
1188 REG_SZ);
1189 list->AddDeleteRegValueWorkItem(root, version_key, 1184 list->AddDeleteRegValueWorkItem(root, version_key,
1190 google_update::kRegCFOptInCmdField, REG_SZ); 1185 google_update::kRegCFOptInCmdField);
1191 } 1186 }
1192 1187
1193 if (update_chrome_uninstall_command) { 1188 if (update_chrome_uninstall_command) {
1194 // Chrome is not a part of this installation run, so we have to explicitly 1189 // Chrome is not a part of this installation run, so we have to explicitly
1195 // check if Chrome is installed, and if so, update its uninstallation 1190 // check if Chrome is installed, and if so, update its uninstallation
1196 // command lines. 1191 // command lines.
1197 BrowserDistribution* chrome_dist = 1192 BrowserDistribution* chrome_dist =
1198 BrowserDistribution::GetSpecificDistribution( 1193 BrowserDistribution::GetSpecificDistribution(
1199 BrowserDistribution::CHROME_BROWSER, prefs); 1194 BrowserDistribution::CHROME_BROWSER, prefs);
1200 const Package& pack = product.package(); 1195 const Package& pack = product.package();
1201 scoped_refptr<Package> package(new Package(pack.multi_install(), 1196 scoped_refptr<Package> package(new Package(pack.multi_install(),
1202 pack.system_level(), pack.path(), pack.properties())); 1197 pack.system_level(), pack.path(), pack.properties()));
1203 scoped_refptr<Product> chrome_product(new Product(chrome_dist, package)); 1198 scoped_refptr<Product> chrome_product(new Product(chrome_dist, package));
1204 AddUninstallShortcutWorkItems(setup_path, new_version, list, 1199 AddUninstallShortcutWorkItems(setup_path, new_version, list,
1205 *chrome_product.get()); 1200 *chrome_product.get());
1206 } 1201 }
1207 } 1202 }
1208 1203
1209 } // namespace installer 1204 } // namespace installer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698