OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <string> | 5 #include <string> |
6 #include <windows.h> | 6 #include <windows.h> |
7 #include <msi.h> | 7 #include <msi.h> |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 return true;; | 566 return true;; |
567 } else if (cmd_line.HasSwitch( | 567 } else if (cmd_line.HasSwitch( |
568 installer_util::switches::kRegisterChromeBrowser)) { | 568 installer_util::switches::kRegisterChromeBrowser)) { |
569 // If --register-chrome-browser option is specified, register all | 569 // If --register-chrome-browser option is specified, register all |
570 // Chrome protocol/file associations as well as register it as a valid | 570 // Chrome protocol/file associations as well as register it as a valid |
571 // browser for Start Menu->Internet shortcut. This option should only | 571 // browser for Start Menu->Internet shortcut. This option should only |
572 // be used when setup.exe is launched with admin rights. We do not | 572 // be used when setup.exe is launched with admin rights. We do not |
573 // make any user specific changes in this option. | 573 // make any user specific changes in this option. |
574 std::wstring chrome_exe(cmd_line.GetSwitchValue( | 574 std::wstring chrome_exe(cmd_line.GetSwitchValue( |
575 installer_util::switches::kRegisterChromeBrowser)); | 575 installer_util::switches::kRegisterChromeBrowser)); |
576 exit_code = ShellUtil::AddChromeToSetAccessDefaults(chrome_exe, true); | 576 std::wstring suffix; |
| 577 if (cmd_line.HasSwitch( |
| 578 installer_util::switches::kRegisterChromeBrowserSuffix)) { |
| 579 suffix = cmd_line.GetSwitchValue( |
| 580 installer_util::switches::kRegisterChromeBrowserSuffix); |
| 581 } |
| 582 exit_code = ShellUtil::RegisterChromeBrowser(chrome_exe, suffix, false); |
577 return true; | 583 return true; |
578 } else if (cmd_line.HasSwitch(installer_util::switches::kRenameChromeExe)) { | 584 } else if (cmd_line.HasSwitch(installer_util::switches::kRenameChromeExe)) { |
579 // If --rename-chrome-exe is specified, we want to rename the executables | 585 // If --rename-chrome-exe is specified, we want to rename the executables |
580 // and exit. | 586 // and exit. |
581 exit_code = RenameChromeExecutables(system_install); | 587 exit_code = RenameChromeExecutables(system_install); |
582 return true; | 588 return true; |
583 } else if (cmd_line.HasSwitch( | 589 } else if (cmd_line.HasSwitch( |
584 installer_util::switches::kRemoveChromeRegistration)) { | 590 installer_util::switches::kRemoveChromeRegistration)) { |
| 591 // This is almost reverse of --register-chrome-browser option above. |
| 592 // Here we delete Chrome browser registration. This option should only |
| 593 // be used when setup.exe is launched with admin rights. We do not |
| 594 // make any user specific changes in this option. |
| 595 std::wstring suffix; |
| 596 if (cmd_line.HasSwitch( |
| 597 installer_util::switches::kRegisterChromeBrowserSuffix)) { |
| 598 suffix = cmd_line.GetSwitchValue( |
| 599 installer_util::switches::kRegisterChromeBrowserSuffix); |
| 600 } |
585 installer_util::InstallStatus tmp = installer_util::UNKNOWN_STATUS; | 601 installer_util::InstallStatus tmp = installer_util::UNKNOWN_STATUS; |
586 installer_setup::DeleteChromeRegistrationKeys(HKEY_LOCAL_MACHINE, tmp); | 602 installer_setup::DeleteChromeRegistrationKeys(HKEY_LOCAL_MACHINE, |
| 603 suffix, tmp); |
587 exit_code = tmp; | 604 exit_code = tmp; |
588 return true; | 605 return true; |
589 } else if (cmd_line.HasSwitch(installer_util::switches::kInactiveUserToast)) { | 606 } else if (cmd_line.HasSwitch(installer_util::switches::kInactiveUserToast)) { |
590 // Launch the inactive user toast experiment. | 607 // Launch the inactive user toast experiment. |
591 dist->InactiveUserToastExperiment(); | 608 dist->InactiveUserToastExperiment(); |
592 return true; | 609 return true; |
593 } | 610 } |
594 return false; | 611 return false; |
595 } | 612 } |
596 | 613 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 } else { | 691 } else { |
675 install_status = InstallChrome(parsed_command_line, | 692 install_status = InstallChrome(parsed_command_line, |
676 installed_version.get(), | 693 installed_version.get(), |
677 options); | 694 options); |
678 } | 695 } |
679 | 696 |
680 CoUninitialize(); | 697 CoUninitialize(); |
681 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 698 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
682 return dist->GetInstallReturnCode(install_status); | 699 return dist->GetInstallReturnCode(install_status); |
683 } | 700 } |
OLD | NEW |