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

Side by Side Diff: chrome/installer/setup/install_worker.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
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file contains the definitions of the installer functions that build 5 // This file contains the definitions of the installer functions that build
6 // the WorkItemList used to install the application. 6 // the WorkItemList used to install the application.
7 7
8 #include "chrome/installer/setup/install_worker.h" 8 #include "chrome/installer/setup/install_worker.h"
9 9
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 336 }
337 337
338 RegKey key; 338 RegKey key;
339 ChannelInfo other_info; 339 ChannelInfo other_info;
340 std::vector<std::wstring>::const_iterator kscan = keys.begin(); 340 std::vector<std::wstring>::const_iterator kscan = keys.begin();
341 std::vector<std::wstring>::const_iterator kend = keys.end(); 341 std::vector<std::wstring>::const_iterator kend = keys.end();
342 for (; kscan != kend; ++kscan) { 342 for (; kscan != kend; ++kscan) {
343 // Handle the case where the ClientState key doesn't exist by creating it. 343 // Handle the case where the ClientState key doesn't exist by creating it.
344 // This takes care of the multi-installer's package key, which is not 344 // This takes care of the multi-installer's package key, which is not
345 // created by Google Update for us. 345 // created by Google Update for us.
346 if (!key.Open(reg_root, kscan->c_str(), KEY_QUERY_VALUE) || 346 if ((key.Open(reg_root, kscan->c_str(), KEY_QUERY_VALUE) != ERROR_SUCCESS)
347 !other_info.Initialize(key)) { 347 || (!other_info.Initialize(key))) {
348 other_info.set_value(std::wstring()); 348 other_info.set_value(std::wstring());
349 } 349 }
350 if (!other_info.Equals(channel_info)) { 350 if (!other_info.Equals(channel_info)) {
351 if (!key.Valid()) 351 if (!key.Valid())
352 install_list->AddCreateRegKeyWorkItem(reg_root, *kscan); 352 install_list->AddCreateRegKeyWorkItem(reg_root, *kscan);
353 install_list->AddSetRegValueWorkItem(reg_root, *kscan, 353 install_list->AddSetRegValueWorkItem(reg_root, *kscan,
354 google_update::kRegApField, 354 google_update::kRegApField,
355 channel_info.value(), true); 355 channel_info.value(), true);
356 } 356 }
357 } 357 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 WorkItem::CreateConditionalWorkItemList( 495 WorkItem::CreateConditionalWorkItemList(
496 new Not(new ConditionRunIfFileExists(new_chrome_exe)))); 496 new Not(new ConditionRunIfFileExists(new_chrome_exe))));
497 regular_update_work_items->set_log_message( 497 regular_update_work_items->set_log_message(
498 "RegularUpdateWorkItemList"); 498 "RegularUpdateWorkItemList");
499 499
500 // Since this was not an in-use-update, delete 'opv' and 'cmd' keys. 500 // Since this was not an in-use-update, delete 'opv' and 'cmd' keys.
501 for (size_t i = 0; i < products.size(); ++i) { 501 for (size_t i = 0; i < products.size(); ++i) {
502 BrowserDistribution* dist = products[i]->distribution(); 502 BrowserDistribution* dist = products[i]->distribution();
503 std::wstring version_key(dist->GetVersionKey()); 503 std::wstring version_key(dist->GetVersionKey());
504 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, 504 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key,
505 google_update::kRegOldVersionField, 505 google_update::kRegOldVersionField);
506 true);
507 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, 506 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key,
508 google_update::kRegRenameCmdField, 507 google_update::kRegRenameCmdField);
509 true);
510 } 508 }
511 509
512 post_install_task_list->AddWorkItem(regular_update_work_items.release()); 510 post_install_task_list->AddWorkItem(regular_update_work_items.release());
513 } 511 }
514 512
515 AddRegisterComDllWorkItemsForPackage(package, current_version, new_version, 513 AddRegisterComDllWorkItemsForPackage(package, current_version, new_version,
516 post_install_task_list); 514 post_install_task_list);
517 515
518 for (size_t i = 0; i < products.size(); ++i) { 516 for (size_t i = 0; i < products.size(); ++i) {
519 const Product* product = products[i]; 517 const Product* product = products[i];
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 // installed with ready mode enabled (the --ready-mode switch should be set 781 // installed with ready mode enabled (the --ready-mode switch should be set
784 // in the registry) so deleting the value should have no effect. 782 // in the registry) so deleting the value should have no effect.
785 // In both cases (install/uninstall), we need to make sure that Chrome's 783 // In both cases (install/uninstall), we need to make sure that Chrome's
786 // uninstallation command line does not include the --chrome-frame switch 784 // uninstallation command line does not include the --chrome-frame switch
787 // so that uninstalling Chrome will no longer uninstall Chrome Frame. 785 // so that uninstalling Chrome will no longer uninstall Chrome Frame.
788 786
789 if (RegKey(root, product.package().properties()->GetStateKey().c_str(), 787 if (RegKey(root, product.package().properties()->GetStateKey().c_str(),
790 KEY_QUERY_VALUE).Valid()) { 788 KEY_QUERY_VALUE).Valid()) {
791 list->AddDeleteRegValueWorkItem(root, 789 list->AddDeleteRegValueWorkItem(root,
792 product.package().properties()->GetStateKey(), 790 product.package().properties()->GetStateKey(),
793 installer::kChromeFrameReadyModeField, REG_QWORD); 791 installer::kChromeFrameReadyModeField);
794 } 792 }
795 793
796 const Product* chrome = installer::FindProduct(product.package().products(), 794 const Product* chrome = installer::FindProduct(product.package().products(),
797 BrowserDistribution::CHROME_BROWSER); 795 BrowserDistribution::CHROME_BROWSER);
798 if (chrome) { 796 if (chrome) {
799 // Chrome is already a part of this installation run, so we can assume 797 // Chrome is already a part of this installation run, so we can assume
800 // that the uninstallation arguments will be updated correctly. 798 // that the uninstallation arguments will be updated correctly.
801 } else { 799 } else {
802 // Chrome is not a part of this installation run, so we have to explicitly 800 // Chrome is not a part of this installation run, so we have to explicitly
803 // check if Chrome is installed, and if so, update its uninstallation 801 // check if Chrome is installed, and if so, update its uninstallation
804 // command lines. 802 // command lines.
805 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( 803 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution(
806 BrowserDistribution::CHROME_BROWSER, 804 BrowserDistribution::CHROME_BROWSER,
807 MasterPreferences::ForCurrentProcess()); 805 MasterPreferences::ForCurrentProcess());
808 update_chrome_uninstall_command = 806 update_chrome_uninstall_command =
809 IsInstalledAsMulti(product.system_level(), dist); 807 IsInstalledAsMulti(product.system_level(), dist);
810 } 808 }
811 } 809 }
812 810
813 if (!ready_mode || !install) { 811 if (!ready_mode || !install) {
814 list->AddDeleteRegValueWorkItem(root, version_key, 812 list->AddDeleteRegValueWorkItem(root, version_key,
815 google_update::kRegCFTempOptOutCmdField, 813 google_update::kRegCFTempOptOutCmdField);
816 REG_SZ);
817 list->AddDeleteRegValueWorkItem(root, version_key, 814 list->AddDeleteRegValueWorkItem(root, version_key,
818 google_update::kRegCFEndTempOptOutCmdField, 815 google_update::kRegCFEndTempOptOutCmdField);
819 REG_SZ);
820 list->AddDeleteRegValueWorkItem(root, version_key, 816 list->AddDeleteRegValueWorkItem(root, version_key,
821 google_update::kRegCFOptOutCmdField, 817 google_update::kRegCFOptOutCmdField);
822 REG_SZ);
823 list->AddDeleteRegValueWorkItem(root, version_key, 818 list->AddDeleteRegValueWorkItem(root, version_key,
824 google_update::kRegCFOptInCmdField, REG_SZ); 819 google_update::kRegCFOptInCmdField);
825 } 820 }
826 821
827 if (update_chrome_uninstall_command) { 822 if (update_chrome_uninstall_command) {
828 // Chrome is not a part of this installation run, so we have to explicitly 823 // Chrome is not a part of this installation run, so we have to explicitly
829 // check if Chrome is installed, and if so, update its uninstallation 824 // check if Chrome is installed, and if so, update its uninstallation
830 // command lines. 825 // command lines.
831 BrowserDistribution* chrome_dist = 826 BrowserDistribution* chrome_dist =
832 BrowserDistribution::GetSpecificDistribution( 827 BrowserDistribution::GetSpecificDistribution(
833 BrowserDistribution::CHROME_BROWSER, prefs); 828 BrowserDistribution::CHROME_BROWSER, prefs);
834 const Package& pack = product.package(); 829 const Package& pack = product.package();
(...skipping 28 matching lines...) Expand all
863 if (prefs.is_multi_install()) { 858 if (prefs.is_multi_install()) {
864 uninstall_cmd->AppendSwitch(installer::switches::kMultiInstall); 859 uninstall_cmd->AppendSwitch(installer::switches::kMultiInstall);
865 } 860 }
866 bool value = false; 861 bool value = false;
867 if (prefs.GetBool(installer::master_preferences::kVerboseLogging, 862 if (prefs.GetBool(installer::master_preferences::kVerboseLogging,
868 &value) && value) 863 &value) && value)
869 uninstall_cmd->AppendSwitch(installer::switches::kVerboseLogging); 864 uninstall_cmd->AppendSwitch(installer::switches::kVerboseLogging);
870 } 865 }
871 866
872 } // namespace installer 867 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698