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

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

Issue 94013004: Add base:: to string16s in chrome/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: try again Created 7 years 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_unittest.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) 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 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 <oaidl.h> 10 #include <oaidl.h>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // built. 82 // built.
83 // TODO(robertshield): Remove this when Chrome Frame works with Aura. 83 // TODO(robertshield): Remove this when Chrome Frame works with Aura.
84 const wchar_t kIELowRightsPolicyCurrentGuid[] = 84 const wchar_t kIELowRightsPolicyCurrentGuid[] =
85 L"{E0A900DF-9611-4446-86BD-4B1D47E7DB2A}"; 85 L"{E0A900DF-9611-4446-86BD-4B1D47E7DB2A}";
86 #endif 86 #endif
87 87
88 const wchar_t kElevationPolicyKeyPath[] = 88 const wchar_t kElevationPolicyKeyPath[] =
89 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\"; 89 L"SOFTWARE\\Microsoft\\Internet Explorer\\Low Rights\\ElevationPolicy\\";
90 90
91 void GetIELowRightsElevationPolicyKeyPath(ElevationPolicyId policy, 91 void GetIELowRightsElevationPolicyKeyPath(ElevationPolicyId policy,
92 string16* key_path) { 92 base::string16* key_path) {
93 DCHECK(policy == CURRENT_ELEVATION_POLICY || policy == OLD_ELEVATION_POLICY); 93 DCHECK(policy == CURRENT_ELEVATION_POLICY || policy == OLD_ELEVATION_POLICY);
94 key_path->assign(kElevationPolicyKeyPath, 94 key_path->assign(kElevationPolicyKeyPath,
95 arraysize(kElevationPolicyKeyPath) - 1); 95 arraysize(kElevationPolicyKeyPath) - 1);
96 if (policy == CURRENT_ELEVATION_POLICY) { 96 if (policy == CURRENT_ELEVATION_POLICY) {
97 #if defined(OMIT_CHROME_FRAME) 97 #if defined(OMIT_CHROME_FRAME)
98 key_path->append(kIELowRightsPolicyCurrentGuid, 98 key_path->append(kIELowRightsPolicyCurrentGuid,
99 arraysize(kIELowRightsPolicyCurrentGuid) - 1); 99 arraysize(kIELowRightsPolicyCurrentGuid) - 1);
100 #else 100 #else
101 wchar_t cf_clsid[64]; 101 wchar_t cf_clsid[64];
102 int len = StringFromGUID2(__uuidof(ChromeFrame), &cf_clsid[0], 102 int len = StringFromGUID2(__uuidof(ChromeFrame), &cf_clsid[0],
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // system-level archive. 204 // system-level archive.
205 install_list->AddCopyTreeWorkItem(archive_path.value(), 205 install_list->AddCopyTreeWorkItem(archive_path.value(),
206 archive_dst.value(), 206 archive_dst.value(),
207 temp_path.value(), 207 temp_path.value(),
208 WorkItem::ALWAYS); 208 WorkItem::ALWAYS);
209 } 209 }
210 } 210 }
211 } 211 }
212 } 212 }
213 213
214 string16 GetRegCommandKey(BrowserDistribution* dist, 214 base::string16 GetRegCommandKey(BrowserDistribution* dist,
215 const wchar_t* name) { 215 const wchar_t* name) {
216 string16 cmd_key(dist->GetVersionKey()); 216 base::string16 cmd_key(dist->GetVersionKey());
217 cmd_key.append(1, base::FilePath::kSeparators[0]) 217 cmd_key.append(1, base::FilePath::kSeparators[0])
218 .append(google_update::kRegCommandsKey) 218 .append(google_update::kRegCommandsKey)
219 .append(1, base::FilePath::kSeparators[0]) 219 .append(1, base::FilePath::kSeparators[0])
220 .append(name); 220 .append(name);
221 return cmd_key; 221 return cmd_key;
222 } 222 }
223 223
224 // Adds work items to create (or delete if uninstalling) app commands to launch 224 // Adds work items to create (or delete if uninstalling) app commands to launch
225 // the app with a switch. The following criteria should be true: 225 // the app with a switch. The following criteria should be true:
226 // 1. The switch takes one parameter. 226 // 1. The switch takes one parameter.
227 // 2. The command send pings. 227 // 2. The command send pings.
228 // 3. The command is web accessible. 228 // 3. The command is web accessible.
229 // 4. The command is run as the user. 229 // 4. The command is run as the user.
230 void AddCommandWithParameterWorkItems(const InstallerState& installer_state, 230 void AddCommandWithParameterWorkItems(const InstallerState& installer_state,
231 const InstallationState& machine_state, 231 const InstallationState& machine_state,
232 const Version& new_version, 232 const Version& new_version,
233 const Product& product, 233 const Product& product,
234 const wchar_t* command_key, 234 const wchar_t* command_key,
235 const wchar_t* app, 235 const wchar_t* app,
236 const char* command_with_parameter, 236 const char* command_with_parameter,
237 WorkItemList* work_item_list) { 237 WorkItemList* work_item_list) {
238 DCHECK(command_key); 238 DCHECK(command_key);
239 DCHECK(app); 239 DCHECK(app);
240 DCHECK(command_with_parameter); 240 DCHECK(command_with_parameter);
241 DCHECK(work_item_list); 241 DCHECK(work_item_list);
242 242
243 string16 full_cmd_key(GetRegCommandKey(product.distribution(), command_key)); 243 base::string16 full_cmd_key(
244 GetRegCommandKey(product.distribution(), command_key));
244 245
245 if (installer_state.operation() == InstallerState::UNINSTALL) { 246 if (installer_state.operation() == InstallerState::UNINSTALL) {
246 work_item_list->AddDeleteRegKeyWorkItem( 247 work_item_list->AddDeleteRegKeyWorkItem(
247 installer_state.root_key(), full_cmd_key)->set_log_message( 248 installer_state.root_key(), full_cmd_key)->set_log_message(
248 "removing " + WideToASCII(command_key) + " command"); 249 "removing " + WideToASCII(command_key) + " command");
249 } else { 250 } else {
250 CommandLine cmd_line(installer_state.target_path().Append(app)); 251 CommandLine cmd_line(installer_state.target_path().Append(app));
251 cmd_line.AppendSwitchASCII(command_with_parameter, "%1"); 252 cmd_line.AppendSwitchASCII(command_with_parameter, "%1");
252 253
253 AppCommand cmd(cmd_line.GetCommandLineString()); 254 AppCommand cmd(cmd_line.GetCommandLineString());
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 346
346 bool will_have_chrome_binaries = 347 bool will_have_chrome_binaries =
347 WillProductBePresentAfterSetup(installer_state, machine_state, 348 WillProductBePresentAfterSetup(installer_state, machine_state,
348 BrowserDistribution::CHROME_BINARIES); 349 BrowserDistribution::CHROME_BINARIES);
349 350
350 // For system-level binaries there is no way to keep the command state in sync 351 // For system-level binaries there is no way to keep the command state in sync
351 // with the installation/uninstallation of the Application Launcher (which is 352 // with the installation/uninstallation of the Application Launcher (which is
352 // always at user-level). So we do not try to remove the command, i.e., it 353 // always at user-level). So we do not try to remove the command, i.e., it
353 // will always be installed if the Chrome Binaries are installed. 354 // will always be installed if the Chrome Binaries are installed.
354 if (will_have_chrome_binaries) { 355 if (will_have_chrome_binaries) {
355 string16 cmd_key(GetRegCommandKey( 356 base::string16 cmd_key(
356 BrowserDistribution::GetSpecificDistribution( 357 GetRegCommandKey(BrowserDistribution::GetSpecificDistribution(
357 BrowserDistribution::CHROME_BINARIES), 358 BrowserDistribution::CHROME_BINARIES),
358 kCmdQuickEnableApplicationHost)); 359 kCmdQuickEnableApplicationHost));
359 CommandLine cmd_line(GetGenericQuickEnableCommand(installer_state, 360 CommandLine cmd_line(GetGenericQuickEnableCommand(installer_state,
360 machine_state, 361 machine_state,
361 setup_path, 362 setup_path,
362 new_version)); 363 new_version));
363 // kMultiInstall and kVerboseLogging were processed above. 364 // kMultiInstall and kVerboseLogging were processed above.
364 cmd_line.AppendSwitch(switches::kChromeAppLauncher); 365 cmd_line.AppendSwitch(switches::kChromeAppLauncher);
365 cmd_line.AppendSwitch(switches::kEnsureGoogleUpdatePresent); 366 cmd_line.AppendSwitch(switches::kEnsureGoogleUpdatePresent);
366 AppCommand cmd(cmd_line.GetCommandLineString()); 367 AppCommand cmd(cmd_line.GetCommandLineString());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 void AddDeleteUninstallShortcutsForMSIWorkItems( 409 void AddDeleteUninstallShortcutsForMSIWorkItems(
409 const InstallerState& installer_state, 410 const InstallerState& installer_state,
410 const Product& product, 411 const Product& product,
411 const base::FilePath& temp_path, 412 const base::FilePath& temp_path,
412 WorkItemList* work_item_list) { 413 WorkItemList* work_item_list) {
413 DCHECK(installer_state.is_msi()) 414 DCHECK(installer_state.is_msi())
414 << "This must only be called for MSI installations!"; 415 << "This must only be called for MSI installations!";
415 416
416 // First attempt to delete the old installation's ARP dialog entry. 417 // First attempt to delete the old installation's ARP dialog entry.
417 HKEY reg_root = installer_state.root_key(); 418 HKEY reg_root = installer_state.root_key();
418 string16 uninstall_reg(product.distribution()->GetUninstallRegPath()); 419 base::string16 uninstall_reg(product.distribution()->GetUninstallRegPath());
419 420
420 WorkItem* delete_reg_key = work_item_list->AddDeleteRegKeyWorkItem( 421 WorkItem* delete_reg_key = work_item_list->AddDeleteRegKeyWorkItem(
421 reg_root, uninstall_reg); 422 reg_root, uninstall_reg);
422 delete_reg_key->set_ignore_failure(true); 423 delete_reg_key->set_ignore_failure(true);
423 424
424 // Then attempt to delete the old installation's start menu shortcut. 425 // Then attempt to delete the old installation's start menu shortcut.
425 base::FilePath uninstall_link; 426 base::FilePath uninstall_link;
426 if (installer_state.system_install()) { 427 if (installer_state.system_install()) {
427 PathService::Get(base::DIR_COMMON_START_MENU, &uninstall_link); 428 PathService::Get(base::DIR_COMMON_START_MENU, &uninstall_link);
428 } else { 429 } else {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 install_list->AddDeleteTreeWorkItem( 562 install_list->AddDeleteTreeWorkItem(
562 target_path.Append(installer::kChromeOldExe), temp_path)-> 563 target_path.Append(installer::kChromeOldExe), temp_path)->
563 set_ignore_failure(true); 564 set_ignore_failure(true);
564 } 565 }
565 566
566 // Probes COM machinery to get an instance of delegate_execute.exe's 567 // Probes COM machinery to get an instance of delegate_execute.exe's
567 // CommandExecuteImpl class. This is required so that COM purges its cache of 568 // CommandExecuteImpl class. This is required so that COM purges its cache of
568 // the path to the binary, which changes on updates. This callback 569 // the path to the binary, which changes on updates. This callback
569 // unconditionally returns true since an install should not be aborted if the 570 // unconditionally returns true since an install should not be aborted if the
570 // probe fails. 571 // probe fails.
571 bool ProbeCommandExecuteCallback(const string16& command_execute_id, 572 bool ProbeCommandExecuteCallback(const base::string16& command_execute_id,
572 const CallbackWorkItem& work_item) { 573 const CallbackWorkItem& work_item) {
573 // Noop on rollback. 574 // Noop on rollback.
574 if (work_item.IsRollback()) 575 if (work_item.IsRollback())
575 return true; 576 return true;
576 577
577 CLSID class_id = {}; 578 CLSID class_id = {};
578 579
579 HRESULT hr = CLSIDFromString(command_execute_id.c_str(), &class_id); 580 HRESULT hr = CLSIDFromString(command_execute_id.c_str(), &class_id);
580 if (FAILED(hr)) { 581 if (FAILED(hr)) {
581 LOG(DFATAL) << "Failed converting \"" << command_execute_id << "\" to " 582 LOG(DFATAL) << "Failed converting \"" << command_execute_id << "\" to "
582 "CLSID; hr=0x" << std::hex << hr; 583 "CLSID; hr=0x" << std::hex << hr;
583 } else { 584 } else {
584 base::win::ScopedComPtr<IUnknown> command_execute_impl; 585 base::win::ScopedComPtr<IUnknown> command_execute_impl;
585 hr = command_execute_impl.CreateInstance(class_id, NULL, 586 hr = command_execute_impl.CreateInstance(class_id, NULL,
586 CLSCTX_LOCAL_SERVER); 587 CLSCTX_LOCAL_SERVER);
587 if (hr != REGDB_E_CLASSNOTREG) { 588 if (hr != REGDB_E_CLASSNOTREG) {
588 LOG(ERROR) << "Unexpected result creating CommandExecuteImpl; hr=0x" 589 LOG(ERROR) << "Unexpected result creating CommandExecuteImpl; hr=0x"
589 << std::hex << hr; 590 << std::hex << hr;
590 } 591 }
591 } 592 }
592 593
593 return true; 594 return true;
594 } 595 }
595 596
596 void AddUninstallDelegateExecuteWorkItems(HKEY root, 597 void AddUninstallDelegateExecuteWorkItems(
597 const string16& delegate_execute_path, 598 HKEY root,
598 WorkItemList* list) { 599 const base::string16& delegate_execute_path,
600 WorkItemList* list) {
599 VLOG(1) << "Adding unregistration items for DelegateExecute verb handler in " 601 VLOG(1) << "Adding unregistration items for DelegateExecute verb handler in "
600 << root; 602 << root;
601 list->AddDeleteRegKeyWorkItem(root, delegate_execute_path); 603 list->AddDeleteRegKeyWorkItem(root, delegate_execute_path);
602 604
603 // In the past, the ICommandExecuteImpl interface and a TypeLib were both 605 // In the past, the ICommandExecuteImpl interface and a TypeLib were both
604 // registered. Remove these since this operation may be updating a machine 606 // registered. Remove these since this operation may be updating a machine
605 // that had the old registrations. 607 // that had the old registrations.
606 list->AddDeleteRegKeyWorkItem(root, 608 list->AddDeleteRegKeyWorkItem(root,
607 L"Software\\Classes\\Interface\\" 609 L"Software\\Classes\\Interface\\"
608 L"{0BA0D4E9-2259-4963-B9AE-A839F7CB7544}"); 610 L"{0BA0D4E9-2259-4963-B9AE-A839F7CB7544}");
(...skipping 11 matching lines...) Expand all
620 // (exclusively -- crrev.com/132596), registered a DelegateExecute class by 622 // (exclusively -- crrev.com/132596), registered a DelegateExecute class by
621 // mistake (with the same GUID as Chrome). The fix stopped registering the bad 623 // mistake (with the same GUID as Chrome). The fix stopped registering the bad
622 // value, but didn't delete it. This is a problem for users who had installed 624 // value, but didn't delete it. This is a problem for users who had installed
623 // Canary before 20.0.1106.0 and now have a system-level Chrome, as the 625 // Canary before 20.0.1106.0 and now have a system-level Chrome, as the
624 // left-behind Canary registrations in HKCU mask the HKLM registrations for the 626 // left-behind Canary registrations in HKCU mask the HKLM registrations for the
625 // same GUID. Cleanup those registrations if they still exist and belong to this 627 // same GUID. Cleanup those registrations if they still exist and belong to this
626 // Canary (i.e., the registered delegate_execute's path is under |target_path|). 628 // Canary (i.e., the registered delegate_execute's path is under |target_path|).
627 void CleanupBadCanaryDelegateExecuteRegistration( 629 void CleanupBadCanaryDelegateExecuteRegistration(
628 const base::FilePath& target_path, 630 const base::FilePath& target_path,
629 WorkItemList* list) { 631 WorkItemList* list) {
630 string16 google_chrome_delegate_execute_path( 632 base::string16 google_chrome_delegate_execute_path(
631 L"Software\\Classes\\CLSID\\{5C65F4B0-3651-4514-B207-D10CB699B14B}"); 633 L"Software\\Classes\\CLSID\\{5C65F4B0-3651-4514-B207-D10CB699B14B}");
632 string16 google_chrome_local_server_32( 634 base::string16 google_chrome_local_server_32(
633 google_chrome_delegate_execute_path + L"\\LocalServer32"); 635 google_chrome_delegate_execute_path + L"\\LocalServer32");
634 636
635 RegKey local_server_32_key; 637 RegKey local_server_32_key;
636 string16 registered_server; 638 base::string16 registered_server;
637 if (local_server_32_key.Open(HKEY_CURRENT_USER, 639 if (local_server_32_key.Open(HKEY_CURRENT_USER,
638 google_chrome_local_server_32.c_str(), 640 google_chrome_local_server_32.c_str(),
639 KEY_QUERY_VALUE) == ERROR_SUCCESS && 641 KEY_QUERY_VALUE) == ERROR_SUCCESS &&
640 local_server_32_key.ReadValue(L"ServerExecutable", 642 local_server_32_key.ReadValue(L"ServerExecutable",
641 &registered_server) == ERROR_SUCCESS && 643 &registered_server) == ERROR_SUCCESS &&
642 target_path.IsParent(base::FilePath(registered_server))) { 644 target_path.IsParent(base::FilePath(registered_server))) {
643 scoped_ptr<WorkItemList> no_rollback_list( 645 scoped_ptr<WorkItemList> no_rollback_list(
644 WorkItem::CreateNoRollbackWorkItemList()); 646 WorkItem::CreateNoRollbackWorkItemList());
645 AddUninstallDelegateExecuteWorkItems( 647 AddUninstallDelegateExecuteWorkItems(
646 HKEY_CURRENT_USER, google_chrome_delegate_execute_path, 648 HKEY_CURRENT_USER, google_chrome_delegate_execute_path,
(...skipping 27 matching lines...) Expand all
674 // Do not quote the command line for the MSI invocation. 676 // Do not quote the command line for the MSI invocation.
675 base::FilePath install_path(installer_state.target_path()); 677 base::FilePath install_path(installer_state.target_path());
676 base::FilePath installer_path( 678 base::FilePath installer_path(
677 installer_state.GetInstallerDirectory(new_version)); 679 installer_state.GetInstallerDirectory(new_version));
678 installer_path = installer_path.Append(setup_path.BaseName()); 680 installer_path = installer_path.Append(setup_path.BaseName());
679 681
680 CommandLine uninstall_arguments(CommandLine::NO_PROGRAM); 682 CommandLine uninstall_arguments(CommandLine::NO_PROGRAM);
681 AppendUninstallCommandLineFlags(installer_state, product, 683 AppendUninstallCommandLineFlags(installer_state, product,
682 &uninstall_arguments); 684 &uninstall_arguments);
683 685
684 string16 update_state_key(browser_dist->GetStateKey()); 686 base::string16 update_state_key(browser_dist->GetStateKey());
685 install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); 687 install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key);
686 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, 688 install_list->AddSetRegValueWorkItem(reg_root, update_state_key,
687 installer::kUninstallStringField, installer_path.value(), true); 689 installer::kUninstallStringField, installer_path.value(), true);
688 install_list->AddSetRegValueWorkItem(reg_root, update_state_key, 690 install_list->AddSetRegValueWorkItem(reg_root, update_state_key,
689 installer::kUninstallArgumentsField, 691 installer::kUninstallArgumentsField,
690 uninstall_arguments.GetCommandLineString(), true); 692 uninstall_arguments.GetCommandLineString(), true);
691 693
692 // MSI installations will manage their own uninstall shortcuts. 694 // MSI installations will manage their own uninstall shortcuts.
693 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { 695 if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) {
694 // We need to quote the command line for the Add/Remove Programs dialog. 696 // We need to quote the command line for the Add/Remove Programs dialog.
695 CommandLine quoted_uninstall_cmd(installer_path); 697 CommandLine quoted_uninstall_cmd(installer_path);
696 DCHECK_EQ(quoted_uninstall_cmd.GetCommandLineString()[0], '"'); 698 DCHECK_EQ(quoted_uninstall_cmd.GetCommandLineString()[0], '"');
697 quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); 699 quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false);
698 700
699 string16 uninstall_reg = browser_dist->GetUninstallRegPath(); 701 base::string16 uninstall_reg = browser_dist->GetUninstallRegPath();
700 install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); 702 install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg);
701 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, 703 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
702 installer::kUninstallDisplayNameField, browser_dist->GetDisplayName(), 704 installer::kUninstallDisplayNameField, browser_dist->GetDisplayName(),
703 true); 705 true);
704 install_list->AddSetRegValueWorkItem(reg_root, 706 install_list->AddSetRegValueWorkItem(reg_root,
705 uninstall_reg, installer::kUninstallStringField, 707 uninstall_reg, installer::kUninstallStringField,
706 quoted_uninstall_cmd.GetCommandLineString(), true); 708 quoted_uninstall_cmd.GetCommandLineString(), true);
707 install_list->AddSetRegValueWorkItem(reg_root, 709 install_list->AddSetRegValueWorkItem(reg_root,
708 uninstall_reg, 710 uninstall_reg,
709 L"InstallLocation", 711 L"InstallLocation",
710 install_path.value(), 712 install_path.value(),
711 true); 713 true);
712 714
713 BrowserDistribution* dist = product.distribution(); 715 BrowserDistribution* dist = product.distribution();
714 string16 chrome_icon = ShellUtil::FormatIconLocation( 716 base::string16 chrome_icon = ShellUtil::FormatIconLocation(
715 install_path.Append(dist->GetIconFilename()).value(), 717 install_path.Append(dist->GetIconFilename()).value(),
716 dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME)); 718 dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME));
717 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, 719 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
718 L"DisplayIcon", chrome_icon, true); 720 L"DisplayIcon", chrome_icon, true);
719 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, 721 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
720 L"NoModify", static_cast<DWORD>(1), 722 L"NoModify", static_cast<DWORD>(1),
721 true); 723 true);
722 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, 724 install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
723 L"NoRepair", static_cast<DWORD>(1), 725 L"NoRepair", static_cast<DWORD>(1),
724 true); 726 true);
(...skipping 28 matching lines...) Expand all
753 755
754 // Create Version key for a product (if not already present) and sets the new 756 // Create Version key for a product (if not already present) and sets the new
755 // product version as the last step. 757 // product version as the last step.
756 void AddVersionKeyWorkItems(HKEY root, 758 void AddVersionKeyWorkItems(HKEY root,
757 BrowserDistribution* dist, 759 BrowserDistribution* dist,
758 const Version& new_version, 760 const Version& new_version,
759 bool add_language_identifier, 761 bool add_language_identifier,
760 WorkItemList* list) { 762 WorkItemList* list) {
761 // Create Version key for each distribution (if not already present) and set 763 // Create Version key for each distribution (if not already present) and set
762 // the new product version as the last step. 764 // the new product version as the last step.
763 string16 version_key(dist->GetVersionKey()); 765 base::string16 version_key(dist->GetVersionKey());
764 list->AddCreateRegKeyWorkItem(root, version_key); 766 list->AddCreateRegKeyWorkItem(root, version_key);
765 767
766 string16 product_name(dist->GetDisplayName()); 768 base::string16 product_name(dist->GetDisplayName());
767 list->AddSetRegValueWorkItem(root, version_key, google_update::kRegNameField, 769 list->AddSetRegValueWorkItem(root, version_key, google_update::kRegNameField,
768 product_name, true); // overwrite name also 770 product_name, true); // overwrite name also
769 list->AddSetRegValueWorkItem(root, version_key, 771 list->AddSetRegValueWorkItem(root, version_key,
770 google_update::kRegOopcrashesField, 772 google_update::kRegOopcrashesField,
771 static_cast<DWORD>(1), 773 static_cast<DWORD>(1),
772 false); // set during first install 774 false); // set during first install
773 if (add_language_identifier) { 775 if (add_language_identifier) {
774 // Write the language identifier of the current translation. Omaha's set of 776 // Write the language identifier of the current translation. Omaha's set of
775 // languages is a superset of Chrome's set of translations with this one 777 // languages is a superset of Chrome's set of translations with this one
776 // exception: what Chrome calls "en-us", Omaha calls "en". sigh. 778 // exception: what Chrome calls "en-us", Omaha calls "en". sigh.
777 string16 language(GetCurrentTranslation()); 779 base::string16 language(GetCurrentTranslation());
778 if (LowerCaseEqualsASCII(language, "en-us")) 780 if (LowerCaseEqualsASCII(language, "en-us"))
779 language.resize(2); 781 language.resize(2);
780 list->AddSetRegValueWorkItem(root, version_key, 782 list->AddSetRegValueWorkItem(root, version_key,
781 google_update::kRegLangField, language, 783 google_update::kRegLangField, language,
782 false); // do not overwrite language 784 false); // do not overwrite language
783 } 785 }
784 list->AddSetRegValueWorkItem(root, version_key, 786 list->AddSetRegValueWorkItem(root, version_key,
785 google_update::kRegVersionField, 787 google_update::kRegVersionField,
786 ASCIIToWide(new_version.GetString()), 788 ASCIIToWide(new_version.GetString()),
787 true); // overwrite version 789 true); // overwrite version
788 } 790 }
789 791
790 // Mirror oeminstall the first time anything is installed multi. There is no 792 // Mirror oeminstall the first time anything is installed multi. There is no
791 // need to update the value on future install/update runs since this value never 793 // need to update the value on future install/update runs since this value never
792 // changes. Note that the value is removed by Google Update after EULA 794 // changes. Note that the value is removed by Google Update after EULA
793 // acceptance is processed. 795 // acceptance is processed.
794 void AddOemInstallWorkItems(const InstallationState& original_state, 796 void AddOemInstallWorkItems(const InstallationState& original_state,
795 const InstallerState& installer_state, 797 const InstallerState& installer_state,
796 WorkItemList* install_list) { 798 WorkItemList* install_list) {
797 DCHECK(installer_state.is_multi_install()); 799 DCHECK(installer_state.is_multi_install());
798 const bool system_install = installer_state.system_install(); 800 const bool system_install = installer_state.system_install();
799 if (!original_state.GetProductState(system_install, 801 if (!original_state.GetProductState(system_install,
800 BrowserDistribution::CHROME_BINARIES)) { 802 BrowserDistribution::CHROME_BINARIES)) {
801 const HKEY root_key = installer_state.root_key(); 803 const HKEY root_key = installer_state.root_key();
802 string16 multi_key( 804 base::string16 multi_key(
803 installer_state.multi_package_binaries_distribution()->GetStateKey()); 805 installer_state.multi_package_binaries_distribution()->GetStateKey());
804 806
805 // Copy the value from Chrome unless Chrome isn't installed or being 807 // Copy the value from Chrome unless Chrome isn't installed or being
806 // installed. 808 // installed.
807 BrowserDistribution::Type source_type; 809 BrowserDistribution::Type source_type;
808 if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER)) { 810 if (installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER)) {
809 source_type = BrowserDistribution::CHROME_BROWSER; 811 source_type = BrowserDistribution::CHROME_BROWSER;
810 } else if (!installer_state.products().empty()) { 812 } else if (!installer_state.products().empty()) {
811 // Pick a product, any product. 813 // Pick a product, any product.
812 source_type = installer_state.products()[0]->distribution()->GetType(); 814 source_type = installer_state.products()[0]->distribution()->GetType();
813 } else { 815 } else {
814 // Nothing is being installed? Entirely unexpected, so do no harm. 816 // Nothing is being installed? Entirely unexpected, so do no harm.
815 LOG(ERROR) << "No products found in AddOemInstallWorkItems"; 817 LOG(ERROR) << "No products found in AddOemInstallWorkItems";
816 return; 818 return;
817 } 819 }
818 const ProductState* source_product = 820 const ProductState* source_product =
819 original_state.GetNonVersionedProductState(system_install, source_type); 821 original_state.GetNonVersionedProductState(system_install, source_type);
820 822
821 string16 oem_install; 823 base::string16 oem_install;
822 if (source_product->GetOemInstall(&oem_install)) { 824 if (source_product->GetOemInstall(&oem_install)) {
823 VLOG(1) << "Mirroring oeminstall=\"" << oem_install << "\" from " 825 VLOG(1) << "Mirroring oeminstall=\"" << oem_install << "\" from "
824 << BrowserDistribution::GetSpecificDistribution(source_type)-> 826 << BrowserDistribution::GetSpecificDistribution(source_type)->
825 GetDisplayName(); 827 GetDisplayName();
826 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); 828 install_list->AddCreateRegKeyWorkItem(root_key, multi_key);
827 // Always overwrite an old value. 829 // Always overwrite an old value.
828 install_list->AddSetRegValueWorkItem(root_key, multi_key, 830 install_list->AddSetRegValueWorkItem(root_key, multi_key,
829 google_update::kRegOemInstallField, 831 google_update::kRegOemInstallField,
830 oem_install, true); 832 oem_install, true);
831 } else { 833 } else {
832 // Clear any old value. 834 // Clear any old value.
833 install_list->AddDeleteRegValueWorkItem( 835 install_list->AddDeleteRegValueWorkItem(
834 root_key, multi_key, google_update::kRegOemInstallField); 836 root_key, multi_key, google_update::kRegOemInstallField);
835 } 837 }
836 } 838 }
837 } 839 }
838 840
839 // Mirror eulaaccepted the first time anything is installed multi. There is no 841 // Mirror eulaaccepted the first time anything is installed multi. There is no
840 // need to update the value on future install/update runs since 842 // need to update the value on future install/update runs since
841 // GoogleUpdateSettings::SetEULAConsent will modify the value for both the 843 // GoogleUpdateSettings::SetEULAConsent will modify the value for both the
842 // relevant product and for the binaries. 844 // relevant product and for the binaries.
843 void AddEulaAcceptedWorkItems(const InstallationState& original_state, 845 void AddEulaAcceptedWorkItems(const InstallationState& original_state,
844 const InstallerState& installer_state, 846 const InstallerState& installer_state,
845 WorkItemList* install_list) { 847 WorkItemList* install_list) {
846 DCHECK(installer_state.is_multi_install()); 848 DCHECK(installer_state.is_multi_install());
847 const bool system_install = installer_state.system_install(); 849 const bool system_install = installer_state.system_install();
848 if (!original_state.GetProductState(system_install, 850 if (!original_state.GetProductState(system_install,
849 BrowserDistribution::CHROME_BINARIES)) { 851 BrowserDistribution::CHROME_BINARIES)) {
850 const HKEY root_key = installer_state.root_key(); 852 const HKEY root_key = installer_state.root_key();
851 string16 multi_key( 853 base::string16 multi_key(
852 installer_state.multi_package_binaries_distribution()->GetStateKey()); 854 installer_state.multi_package_binaries_distribution()->GetStateKey());
853 855
854 // Copy the value from the product with the greatest value. 856 // Copy the value from the product with the greatest value.
855 bool have_eula_accepted = false; 857 bool have_eula_accepted = false;
856 BrowserDistribution::Type product_type; 858 BrowserDistribution::Type product_type;
857 DWORD eula_accepted; 859 DWORD eula_accepted;
858 const Products& products = installer_state.products(); 860 const Products& products = installer_state.products();
859 for (Products::const_iterator it = products.begin(); it < products.end(); 861 for (Products::const_iterator it = products.begin(); it < products.end();
860 ++it) { 862 ++it) {
861 const Product& product = **it; 863 const Product& product = **it;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 WorkItemList* install_list) { 898 WorkItemList* install_list) {
897 // Is a multi-install product being installed or over-installed? 899 // Is a multi-install product being installed or over-installed?
898 if (installer_state.operation() != InstallerState::MULTI_INSTALL && 900 if (installer_state.operation() != InstallerState::MULTI_INSTALL &&
899 installer_state.operation() != InstallerState::MULTI_UPDATE) { 901 installer_state.operation() != InstallerState::MULTI_UPDATE) {
900 VLOG(1) << "AddGoogleUpdateWorkItems noop: " << installer_state.operation(); 902 VLOG(1) << "AddGoogleUpdateWorkItems noop: " << installer_state.operation();
901 return; 903 return;
902 } 904 }
903 905
904 const bool system_install = installer_state.system_install(); 906 const bool system_install = installer_state.system_install();
905 const HKEY root_key = installer_state.root_key(); 907 const HKEY root_key = installer_state.root_key();
906 string16 multi_key( 908 base::string16 multi_key(
907 installer_state.multi_package_binaries_distribution()->GetStateKey()); 909 installer_state.multi_package_binaries_distribution()->GetStateKey());
908 910
909 // For system-level installs, make sure the ClientStateMedium key for the 911 // For system-level installs, make sure the ClientStateMedium key for the
910 // binaries exists. 912 // binaries exists.
911 if (system_install) { 913 if (system_install) {
912 install_list->AddCreateRegKeyWorkItem( 914 install_list->AddCreateRegKeyWorkItem(
913 root_key, 915 root_key,
914 installer_state.multi_package_binaries_distribution()-> 916 installer_state.multi_package_binaries_distribution()->
915 GetStateMediumKey().c_str()); 917 GetStateMediumKey().c_str());
916 } 918 }
917 919
918 // Creating the ClientState key for binaries, if we're migrating to multi then 920 // Creating the ClientState key for binaries, if we're migrating to multi then
919 // copy over Chrome's brand code if it has one. Chrome Frame currently never 921 // copy over Chrome's brand code if it has one. Chrome Frame currently never
920 // has a brand code. 922 // has a brand code.
921 if (installer_state.state_type() != BrowserDistribution::CHROME_BINARIES) { 923 if (installer_state.state_type() != BrowserDistribution::CHROME_BINARIES) {
922 const ProductState* chrome_product_state = 924 const ProductState* chrome_product_state =
923 original_state.GetNonVersionedProductState( 925 original_state.GetNonVersionedProductState(
924 system_install, BrowserDistribution::CHROME_BROWSER); 926 system_install, BrowserDistribution::CHROME_BROWSER);
925 927
926 const string16& brand(chrome_product_state->brand()); 928 const base::string16& brand(chrome_product_state->brand());
927 if (!brand.empty()) { 929 if (!brand.empty()) {
928 install_list->AddCreateRegKeyWorkItem(root_key, multi_key); 930 install_list->AddCreateRegKeyWorkItem(root_key, multi_key);
929 // Write Chrome's brand code to the multi key. Never overwrite the value 931 // Write Chrome's brand code to the multi key. Never overwrite the value
930 // if one is already present (although this shouldn't happen). 932 // if one is already present (although this shouldn't happen).
931 install_list->AddSetRegValueWorkItem(root_key, 933 install_list->AddSetRegValueWorkItem(root_key,
932 multi_key, 934 multi_key,
933 google_update::kRegBrandField, 935 google_update::kRegBrandField,
934 brand, 936 brand,
935 false); 937 false);
936 } 938 }
(...skipping 26 matching lines...) Expand all
963 BrowserDistribution* dist = (*scan)->distribution(); 965 BrowserDistribution* dist = (*scan)->distribution();
964 const ProductState* product_state = 966 const ProductState* product_state =
965 original_state.GetNonVersionedProductState( 967 original_state.GetNonVersionedProductState(
966 installer_state.system_install(), dist->GetType()); 968 installer_state.system_install(), dist->GetType());
967 value_found = product_state->GetUsageStats(&usagestats); 969 value_found = product_state->GetUsageStats(&usagestats);
968 } 970 }
969 971
970 // If a value was found, write it in the appropriate location for the 972 // If a value was found, write it in the appropriate location for the
971 // binaries and remove all values from the products. 973 // binaries and remove all values from the products.
972 if (value_found) { 974 if (value_found) {
973 string16 state_key( 975 base::string16 state_key(
974 installer_state.multi_package_binaries_distribution()->GetStateKey()); 976 installer_state.multi_package_binaries_distribution()->GetStateKey());
975 install_list->AddCreateRegKeyWorkItem(root_key, state_key); 977 install_list->AddCreateRegKeyWorkItem(root_key, state_key);
976 // Overwrite any existing value so that overinstalls (where Omaha writes a 978 // Overwrite any existing value so that overinstalls (where Omaha writes a
977 // new value into a product's state key) pick up the correct value. 979 // new value into a product's state key) pick up the correct value.
978 install_list->AddSetRegValueWorkItem(root_key, state_key, 980 install_list->AddSetRegValueWorkItem(root_key, state_key,
979 google_update::kRegUsageStatsField, 981 google_update::kRegUsageStatsField,
980 usagestats, true); 982 usagestats, true);
981 983
982 for (Products::const_iterator scan = products.begin(), end = products.end(); 984 for (Products::const_iterator scan = products.begin(), end = products.end();
983 scan != end; ++scan) { 985 scan != end; ++scan) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 setup_path.BaseName())); 1034 setup_path.BaseName()));
1033 1035
1034 CommandLine rename(installer_path); 1036 CommandLine rename(installer_path);
1035 rename.AppendSwitch(switches::kRenameChromeExe); 1037 rename.AppendSwitch(switches::kRenameChromeExe);
1036 if (installer_state.system_install()) 1038 if (installer_state.system_install())
1037 rename.AppendSwitch(switches::kSystemLevel); 1039 rename.AppendSwitch(switches::kSystemLevel);
1038 1040
1039 if (installer_state.verbose_logging()) 1041 if (installer_state.verbose_logging())
1040 rename.AppendSwitch(switches::kVerboseLogging); 1042 rename.AppendSwitch(switches::kVerboseLogging);
1041 1043
1042 string16 version_key; 1044 base::string16 version_key;
1043 for (size_t i = 0; i < products.size(); ++i) { 1045 for (size_t i = 0; i < products.size(); ++i) {
1044 BrowserDistribution* dist = products[i]->distribution(); 1046 BrowserDistribution* dist = products[i]->distribution();
1045 version_key = dist->GetVersionKey(); 1047 version_key = dist->GetVersionKey();
1046 1048
1047 if (current_version) { 1049 if (current_version) {
1048 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key, 1050 in_use_update_work_items->AddSetRegValueWorkItem(root, version_key,
1049 google_update::kRegOldVersionField, 1051 google_update::kRegOldVersionField,
1050 ASCIIToWide(current_version->GetString()), true); 1052 ASCIIToWide(current_version->GetString()), true);
1051 } 1053 }
1052 if (critical_version.IsValid()) { 1054 if (critical_version.IsValid()) {
(...skipping 30 matching lines...) Expand all
1083 // Append work items that will be executed if this was NOT an in-use update. 1085 // Append work items that will be executed if this was NOT an in-use update.
1084 { 1086 {
1085 scoped_ptr<WorkItemList> regular_update_work_items( 1087 scoped_ptr<WorkItemList> regular_update_work_items(
1086 WorkItem::CreateConditionalWorkItemList( 1088 WorkItem::CreateConditionalWorkItemList(
1087 new Not(new ConditionRunIfFileExists(new_chrome_exe)))); 1089 new Not(new ConditionRunIfFileExists(new_chrome_exe))));
1088 regular_update_work_items->set_log_message("RegularUpdateWorkItemList"); 1090 regular_update_work_items->set_log_message("RegularUpdateWorkItemList");
1089 1091
1090 // Since this was not an in-use-update, delete 'opv', 'cpv', and 'cmd' keys. 1092 // Since this was not an in-use-update, delete 'opv', 'cpv', and 'cmd' keys.
1091 for (size_t i = 0; i < products.size(); ++i) { 1093 for (size_t i = 0; i < products.size(); ++i) {
1092 BrowserDistribution* dist = products[i]->distribution(); 1094 BrowserDistribution* dist = products[i]->distribution();
1093 string16 version_key(dist->GetVersionKey()); 1095 base::string16 version_key(dist->GetVersionKey());
1094 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, 1096 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key,
1095 google_update::kRegOldVersionField); 1097 google_update::kRegOldVersionField);
1096 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, 1098 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key,
1097 google_update::kRegCriticalVersionField); 1099 google_update::kRegCriticalVersionField);
1098 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key, 1100 regular_update_work_items->AddDeleteRegValueWorkItem(root, version_key,
1099 google_update::kRegRenameCmdField); 1101 google_update::kRegRenameCmdField);
1100 } 1102 }
1101 1103
1102 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { 1104 if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) {
1103 AddDeleteOldIELowRightsPolicyWorkItems(installer_state, 1105 AddDeleteOldIELowRightsPolicyWorkItems(installer_state,
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 DCHECK(set_msi_work_item); 1267 DCHECK(set_msi_work_item);
1266 set_msi_work_item->set_ignore_failure(true); 1268 set_msi_work_item->set_ignore_failure(true);
1267 set_msi_work_item->set_log_message("Could not write MSI marker!"); 1269 set_msi_work_item->set_log_message("Could not write MSI marker!");
1268 } 1270 }
1269 1271
1270 void AddDelegateExecuteWorkItems(const InstallerState& installer_state, 1272 void AddDelegateExecuteWorkItems(const InstallerState& installer_state,
1271 const base::FilePath& target_path, 1273 const base::FilePath& target_path,
1272 const Version& new_version, 1274 const Version& new_version,
1273 const Product& product, 1275 const Product& product,
1274 WorkItemList* list) { 1276 WorkItemList* list) {
1275 string16 handler_class_uuid; 1277 base::string16 handler_class_uuid;
1276 BrowserDistribution* dist = product.distribution(); 1278 BrowserDistribution* dist = product.distribution();
1277 if (!dist->GetCommandExecuteImplClsid(&handler_class_uuid)) { 1279 if (!dist->GetCommandExecuteImplClsid(&handler_class_uuid)) {
1278 if (InstallUtil::IsChromeSxSProcess()) { 1280 if (InstallUtil::IsChromeSxSProcess()) {
1279 CleanupBadCanaryDelegateExecuteRegistration(target_path, list); 1281 CleanupBadCanaryDelegateExecuteRegistration(target_path, list);
1280 } else { 1282 } else {
1281 VLOG(1) << "No DelegateExecute verb handler processing to do for " 1283 VLOG(1) << "No DelegateExecute verb handler processing to do for "
1282 << dist->GetDisplayName(); 1284 << dist->GetDisplayName();
1283 } 1285 }
1284 return; 1286 return;
1285 } 1287 }
1286 1288
1287 HKEY root = installer_state.root_key(); 1289 HKEY root = installer_state.root_key();
1288 string16 delegate_execute_path(L"Software\\Classes\\CLSID\\"); 1290 base::string16 delegate_execute_path(L"Software\\Classes\\CLSID\\");
1289 delegate_execute_path.append(handler_class_uuid); 1291 delegate_execute_path.append(handler_class_uuid);
1290 1292
1291 // Unconditionally remove registration regardless of whether or not it is 1293 // Unconditionally remove registration regardless of whether or not it is
1292 // needed since builds after r132190 included it when it wasn't strictly 1294 // needed since builds after r132190 included it when it wasn't strictly
1293 // necessary. Do this removal before adding in the new key to ensure that 1295 // necessary. Do this removal before adding in the new key to ensure that
1294 // the COM probe/flush below does its job. 1296 // the COM probe/flush below does its job.
1295 AddUninstallDelegateExecuteWorkItems(root, delegate_execute_path, list); 1297 AddUninstallDelegateExecuteWorkItems(root, delegate_execute_path, list);
1296 1298
1297 // Add work items to register the handler iff it is present. 1299 // Add work items to register the handler iff it is present.
1298 // See also shell_util.cc's GetProgIdEntries. 1300 // See also shell_util.cc's GetProgIdEntries.
1299 if (installer_state.operation() != InstallerState::UNINSTALL) { 1301 if (installer_state.operation() != InstallerState::UNINSTALL) {
1300 VLOG(1) << "Adding registration items for DelegateExecute verb handler."; 1302 VLOG(1) << "Adding registration items for DelegateExecute verb handler.";
1301 1303
1302 // Force COM to flush its cache containing the path to the old handler. 1304 // Force COM to flush its cache containing the path to the old handler.
1303 list->AddCallbackWorkItem(base::Bind(&ProbeCommandExecuteCallback, 1305 list->AddCallbackWorkItem(base::Bind(&ProbeCommandExecuteCallback,
1304 handler_class_uuid)); 1306 handler_class_uuid));
1305 1307
1306 // The path to the exe (in the version directory). 1308 // The path to the exe (in the version directory).
1307 base::FilePath delegate_execute(target_path); 1309 base::FilePath delegate_execute(target_path);
1308 if (new_version.IsValid()) 1310 if (new_version.IsValid())
1309 delegate_execute = delegate_execute.AppendASCII(new_version.GetString()); 1311 delegate_execute = delegate_execute.AppendASCII(new_version.GetString());
1310 delegate_execute = delegate_execute.Append(kDelegateExecuteExe); 1312 delegate_execute = delegate_execute.Append(kDelegateExecuteExe);
1311 1313
1312 // Command-line featuring the quoted path to the exe. 1314 // Command-line featuring the quoted path to the exe.
1313 string16 command(1, L'"'); 1315 base::string16 command(1, L'"');
1314 command.append(delegate_execute.value()).append(1, L'"'); 1316 command.append(delegate_execute.value()).append(1, L'"');
1315 1317
1316 // Register the CommandExecuteImpl class in Software\Classes\CLSID\... 1318 // Register the CommandExecuteImpl class in Software\Classes\CLSID\...
1317 list->AddCreateRegKeyWorkItem(root, delegate_execute_path); 1319 list->AddCreateRegKeyWorkItem(root, delegate_execute_path);
1318 list->AddSetRegValueWorkItem(root, delegate_execute_path, L"", 1320 list->AddSetRegValueWorkItem(root, delegate_execute_path, L"",
1319 L"CommandExecuteImpl Class", true); 1321 L"CommandExecuteImpl Class", true);
1320 string16 subkey(delegate_execute_path); 1322 base::string16 subkey(delegate_execute_path);
1321 subkey.append(L"\\LocalServer32"); 1323 subkey.append(L"\\LocalServer32");
1322 list->AddCreateRegKeyWorkItem(root, subkey); 1324 list->AddCreateRegKeyWorkItem(root, subkey);
1323 list->AddSetRegValueWorkItem(root, subkey, L"", command, true); 1325 list->AddSetRegValueWorkItem(root, subkey, L"", command, true);
1324 list->AddSetRegValueWorkItem(root, subkey, L"ServerExecutable", 1326 list->AddSetRegValueWorkItem(root, subkey, L"ServerExecutable",
1325 delegate_execute.value(), true); 1327 delegate_execute.value(), true);
1326 1328
1327 subkey.assign(delegate_execute_path).append(L"\\Programmable"); 1329 subkey.assign(delegate_execute_path).append(L"\\Programmable");
1328 list->AddCreateRegKeyWorkItem(root, subkey); 1330 list->AddCreateRegKeyWorkItem(root, subkey);
1329 } 1331 }
1330 } 1332 }
1331 1333
1332 void AddActiveSetupWorkItems(const InstallerState& installer_state, 1334 void AddActiveSetupWorkItems(const InstallerState& installer_state,
1333 const base::FilePath& setup_path, 1335 const base::FilePath& setup_path,
1334 const Version& new_version, 1336 const Version& new_version,
1335 const Product& product, 1337 const Product& product,
1336 WorkItemList* list) { 1338 WorkItemList* list) {
1337 DCHECK(installer_state.operation() != InstallerState::UNINSTALL); 1339 DCHECK(installer_state.operation() != InstallerState::UNINSTALL);
1338 BrowserDistribution* dist = product.distribution(); 1340 BrowserDistribution* dist = product.distribution();
1339 1341
1340 if (!product.is_chrome() || !installer_state.system_install()) { 1342 if (!product.is_chrome() || !installer_state.system_install()) {
1341 const char* install_level = 1343 const char* install_level =
1342 installer_state.system_install() ? "system" : "user"; 1344 installer_state.system_install() ? "system" : "user";
1343 VLOG(1) << "No Active Setup processing to do for " << install_level 1345 VLOG(1) << "No Active Setup processing to do for " << install_level
1344 << "-level " << dist->GetDisplayName(); 1346 << "-level " << dist->GetDisplayName();
1345 return; 1347 return;
1346 } 1348 }
1347 DCHECK(installer_state.RequiresActiveSetup()); 1349 DCHECK(installer_state.RequiresActiveSetup());
1348 1350
1349 const HKEY root = HKEY_LOCAL_MACHINE; 1351 const HKEY root = HKEY_LOCAL_MACHINE;
1350 const string16 active_setup_path(InstallUtil::GetActiveSetupPath(dist)); 1352 const base::string16 active_setup_path(InstallUtil::GetActiveSetupPath(dist));
1351 1353
1352 VLOG(1) << "Adding registration items for Active Setup."; 1354 VLOG(1) << "Adding registration items for Active Setup.";
1353 list->AddCreateRegKeyWorkItem(root, active_setup_path); 1355 list->AddCreateRegKeyWorkItem(root, active_setup_path);
1354 list->AddSetRegValueWorkItem(root, active_setup_path, L"", 1356 list->AddSetRegValueWorkItem(root, active_setup_path, L"",
1355 dist->GetDisplayName(), true); 1357 dist->GetDisplayName(), true);
1356 1358
1357 base::FilePath active_setup_exe(installer_state.GetInstallerDirectory( 1359 base::FilePath active_setup_exe(installer_state.GetInstallerDirectory(
1358 new_version).Append(kActiveSetupExe)); 1360 new_version).Append(kActiveSetupExe));
1359 CommandLine cmd(active_setup_exe); 1361 CommandLine cmd(active_setup_exe);
1360 cmd.AppendSwitch(installer::switches::kConfigureUserSettings); 1362 cmd.AppendSwitch(installer::switches::kConfigureUserSettings);
(...skipping 13 matching lines...) Expand all
1374 1376
1375 list->AddSetRegValueWorkItem(root, active_setup_path, L"Version", 1377 list->AddSetRegValueWorkItem(root, active_setup_path, L"Version",
1376 kActiveSetupVersion, true); 1378 kActiveSetupVersion, true);
1377 } 1379 }
1378 1380
1379 void AddDeleteOldIELowRightsPolicyWorkItems( 1381 void AddDeleteOldIELowRightsPolicyWorkItems(
1380 const InstallerState& installer_state, 1382 const InstallerState& installer_state,
1381 WorkItemList* install_list) { 1383 WorkItemList* install_list) {
1382 DCHECK(install_list); 1384 DCHECK(install_list);
1383 1385
1384 string16 key_path; 1386 base::string16 key_path;
1385 GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &key_path); 1387 GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &key_path);
1386 install_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), key_path); 1388 install_list->AddDeleteRegKeyWorkItem(installer_state.root_key(), key_path);
1387 } 1389 }
1388 1390
1389 // Adds work items to copy the chrome_launcher IE low rights elevation policy 1391 // Adds work items to copy the chrome_launcher IE low rights elevation policy
1390 // from the primary policy GUID to the "old" policy GUID. Take care not to 1392 // from the primary policy GUID to the "old" policy GUID. Take care not to
1391 // perform the copy if there is already an old policy present, as the ones under 1393 // perform the copy if there is already an old policy present, as the ones under
1392 // the main kElevationPolicyGuid would then correspond to an intermediate 1394 // the main kElevationPolicyGuid would then correspond to an intermediate
1393 // version (current_version < pv < new_version). 1395 // version (current_version < pv < new_version).
1394 void AddCopyIELowRightsPolicyWorkItems(const InstallerState& installer_state, 1396 void AddCopyIELowRightsPolicyWorkItems(const InstallerState& installer_state,
1395 WorkItemList* install_list) { 1397 WorkItemList* install_list) {
1396 DCHECK(install_list); 1398 DCHECK(install_list);
1397 1399
1398 string16 current_key_path; 1400 base::string16 current_key_path;
1399 string16 old_key_path; 1401 base::string16 old_key_path;
1400 1402
1401 GetIELowRightsElevationPolicyKeyPath(CURRENT_ELEVATION_POLICY, 1403 GetIELowRightsElevationPolicyKeyPath(CURRENT_ELEVATION_POLICY,
1402 &current_key_path); 1404 &current_key_path);
1403 GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &old_key_path); 1405 GetIELowRightsElevationPolicyKeyPath(OLD_ELEVATION_POLICY, &old_key_path);
1404 // Do not clobber existing old policies. 1406 // Do not clobber existing old policies.
1405 install_list->AddCopyRegKeyWorkItem(installer_state.root_key(), 1407 install_list->AddCopyRegKeyWorkItem(installer_state.root_key(),
1406 current_key_path, old_key_path, 1408 current_key_path, old_key_path,
1407 WorkItem::IF_NOT_PRESENT); 1409 WorkItem::IF_NOT_PRESENT);
1408 } 1410 }
1409 1411
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 VLOG(1) << "Cannot load " << kIEFrameDll; 1452 VLOG(1) << "Cannot load " << kIEFrameDll;
1451 } 1453 }
1452 } 1454 }
1453 1455
1454 void AddOsUpgradeWorkItems(const InstallerState& installer_state, 1456 void AddOsUpgradeWorkItems(const InstallerState& installer_state,
1455 const base::FilePath& setup_path, 1457 const base::FilePath& setup_path,
1456 const Version& new_version, 1458 const Version& new_version,
1457 const Product& product, 1459 const Product& product,
1458 WorkItemList* install_list) { 1460 WorkItemList* install_list) {
1459 const HKEY root_key = installer_state.root_key(); 1461 const HKEY root_key = installer_state.root_key();
1460 string16 cmd_key(GetRegCommandKey(product.distribution(), kCmdOnOsUpgrade)); 1462 base::string16 cmd_key(
1463 GetRegCommandKey(product.distribution(), kCmdOnOsUpgrade));
1461 1464
1462 if (installer_state.operation() == InstallerState::UNINSTALL) { 1465 if (installer_state.operation() == InstallerState::UNINSTALL) {
1463 install_list->AddDeleteRegKeyWorkItem(root_key, cmd_key)-> 1466 install_list->AddDeleteRegKeyWorkItem(root_key, cmd_key)->
1464 set_log_message("Removing OS upgrade command"); 1467 set_log_message("Removing OS upgrade command");
1465 } else { 1468 } else {
1466 // Register with Google Update to have setup.exe --on-os-upgrade called on 1469 // Register with Google Update to have setup.exe --on-os-upgrade called on
1467 // OS upgrade. 1470 // OS upgrade.
1468 CommandLine cmd_line(installer_state 1471 CommandLine cmd_line(installer_state
1469 .GetInstallerDirectory(new_version) 1472 .GetInstallerDirectory(new_version)
1470 .Append(setup_path.BaseName())); 1473 .Append(setup_path.BaseName()));
(...skipping 11 matching lines...) Expand all
1482 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list); 1485 cmd.AddWorkItems(installer_state.root_key(), cmd_key, install_list);
1483 } 1486 }
1484 } 1487 }
1485 1488
1486 void AddQueryEULAAcceptanceWorkItems(const InstallerState& installer_state, 1489 void AddQueryEULAAcceptanceWorkItems(const InstallerState& installer_state,
1487 const base::FilePath& setup_path, 1490 const base::FilePath& setup_path,
1488 const Version& new_version, 1491 const Version& new_version,
1489 const Product& product, 1492 const Product& product,
1490 WorkItemList* work_item_list) { 1493 WorkItemList* work_item_list) {
1491 const HKEY root_key = installer_state.root_key(); 1494 const HKEY root_key = installer_state.root_key();
1492 string16 cmd_key(GetRegCommandKey(product.distribution(), 1495 base::string16 cmd_key(
1493 kCmdQueryEULAAcceptance)); 1496 GetRegCommandKey(product.distribution(), kCmdQueryEULAAcceptance));
1494 if (installer_state.operation() == InstallerState::UNINSTALL) { 1497 if (installer_state.operation() == InstallerState::UNINSTALL) {
1495 work_item_list->AddDeleteRegKeyWorkItem(root_key, cmd_key)-> 1498 work_item_list->AddDeleteRegKeyWorkItem(root_key, cmd_key)->
1496 set_log_message("Removing query EULA acceptance command"); 1499 set_log_message("Removing query EULA acceptance command");
1497 } else { 1500 } else {
1498 CommandLine cmd_line(installer_state 1501 CommandLine cmd_line(installer_state
1499 .GetInstallerDirectory(new_version) 1502 .GetInstallerDirectory(new_version)
1500 .Append(setup_path.BaseName())); 1503 .Append(setup_path.BaseName()));
1501 cmd_line.AppendSwitch(switches::kQueryEULAAcceptance); 1504 cmd_line.AppendSwitch(switches::kQueryEULAAcceptance);
1502 if (installer_state.system_install()) 1505 if (installer_state.system_install())
1503 cmd_line.AppendSwitch(installer::switches::kSystemLevel); 1506 cmd_line.AppendSwitch(installer::switches::kSystemLevel);
1504 if (installer_state.verbose_logging()) 1507 if (installer_state.verbose_logging())
1505 cmd_line.AppendSwitch(installer::switches::kVerboseLogging); 1508 cmd_line.AppendSwitch(installer::switches::kVerboseLogging);
1506 AppCommand cmd(cmd_line.GetCommandLineString()); 1509 AppCommand cmd(cmd_line.GetCommandLineString());
1507 cmd.set_is_web_accessible(true); 1510 cmd.set_is_web_accessible(true);
1508 cmd.set_is_run_as_user(true); 1511 cmd.set_is_run_as_user(true);
1509 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list); 1512 cmd.AddWorkItems(installer_state.root_key(), cmd_key, work_item_list);
1510 } 1513 }
1511 } 1514 }
1512 1515
1513 void AddQuickEnableChromeFrameWorkItems(const InstallerState& installer_state, 1516 void AddQuickEnableChromeFrameWorkItems(const InstallerState& installer_state,
1514 WorkItemList* work_item_list) { 1517 WorkItemList* work_item_list) {
1515 DCHECK(work_item_list); 1518 DCHECK(work_item_list);
1516 1519
1517 string16 cmd_key(GetRegCommandKey( 1520 base::string16 cmd_key(
1518 BrowserDistribution::GetSpecificDistribution( 1521 GetRegCommandKey(BrowserDistribution::GetSpecificDistribution(
1519 BrowserDistribution::CHROME_BINARIES), 1522 BrowserDistribution::CHROME_BINARIES),
1520 kCmdQuickEnableCf)); 1523 kCmdQuickEnableCf));
1521 1524
1522 // Unconditionally remove the legacy Quick Enable command from the binaries. 1525 // Unconditionally remove the legacy Quick Enable command from the binaries.
1523 // Do this even if multi-install Chrome isn't installed to ensure that it is 1526 // Do this even if multi-install Chrome isn't installed to ensure that it is
1524 // not left behind in any case. 1527 // not left behind in any case.
1525 work_item_list->AddDeleteRegKeyWorkItem( 1528 work_item_list->AddDeleteRegKeyWorkItem(
1526 installer_state.root_key(), cmd_key)->set_log_message( 1529 installer_state.root_key(), cmd_key)->set_log_message(
1527 "removing " + WideToASCII(kCmdQuickEnableCf) + " command"); 1530 "removing " + WideToASCII(kCmdQuickEnableCf) + " command");
1528 1531
1529 } 1532 }
1530 1533
1531 } // namespace installer 1534 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_unittest.cc ('k') | chrome/installer/setup/setup_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698