| 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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 return true;; | 543 return true;; |
| 544 } else if (cmd_line.HasSwitch( | 544 } else if (cmd_line.HasSwitch( |
| 545 installer_util::switches::kRegisterChromeBrowser)) { | 545 installer_util::switches::kRegisterChromeBrowser)) { |
| 546 // If --register-chrome-browser option is specified, register all | 546 // If --register-chrome-browser option is specified, register all |
| 547 // Chrome protocol/file associations as well as register it as a valid | 547 // Chrome protocol/file associations as well as register it as a valid |
| 548 // browser for Start Menu->Internet shortcut. This option should only | 548 // browser for Start Menu->Internet shortcut. This option should only |
| 549 // be used when setup.exe is launched with admin rights. We do not | 549 // be used when setup.exe is launched with admin rights. We do not |
| 550 // make any user specific changes in this option. | 550 // make any user specific changes in this option. |
| 551 std::wstring chrome_exe(cmd_line.GetSwitchValue( | 551 std::wstring chrome_exe(cmd_line.GetSwitchValue( |
| 552 installer_util::switches::kRegisterChromeBrowser)); | 552 installer_util::switches::kRegisterChromeBrowser)); |
| 553 exit_code = ShellUtil::AddChromeToSetAccessDefaults(chrome_exe, true); | 553 std::wstring suffix; |
| 554 if (cmd_line.HasSwitch( |
| 555 installer_util::switches::kRegisterChromeBrowserSuffix)) { |
| 556 suffix = cmd_line.GetSwitchValue( |
| 557 installer_util::switches::kRegisterChromeBrowserSuffix); |
| 558 } |
| 559 exit_code = ShellUtil::RegisterChromeBrowser(chrome_exe, suffix, false); |
| 554 return true; | 560 return true; |
| 555 } else if (cmd_line.HasSwitch(installer_util::switches::kRenameChromeExe)) { | 561 } else if (cmd_line.HasSwitch(installer_util::switches::kRenameChromeExe)) { |
| 556 // If --rename-chrome-exe is specified, we want to rename the executables | 562 // If --rename-chrome-exe is specified, we want to rename the executables |
| 557 // and exit. | 563 // and exit. |
| 558 exit_code = RenameChromeExecutables(system_install); | 564 exit_code = RenameChromeExecutables(system_install); |
| 559 return true; | 565 return true; |
| 560 } else if (cmd_line.HasSwitch( | 566 } else if (cmd_line.HasSwitch( |
| 561 installer_util::switches::kRemoveChromeRegistration)) { | 567 installer_util::switches::kRemoveChromeRegistration)) { |
| 568 // This is almost reverse of --register-chrome-browser option above. |
| 569 // Here we delete Chrome browser registration. This option should only |
| 570 // be used when setup.exe is launched with admin rights. We do not |
| 571 // make any user specific changes in this option. |
| 572 std::wstring suffix; |
| 573 if (cmd_line.HasSwitch( |
| 574 installer_util::switches::kRegisterChromeBrowserSuffix)) { |
| 575 suffix = cmd_line.GetSwitchValue( |
| 576 installer_util::switches::kRegisterChromeBrowserSuffix); |
| 577 } |
| 562 installer_util::InstallStatus tmp = installer_util::UNKNOWN_STATUS; | 578 installer_util::InstallStatus tmp = installer_util::UNKNOWN_STATUS; |
| 563 installer_setup::DeleteChromeRegistrationKeys(HKEY_LOCAL_MACHINE, tmp); | 579 installer_setup::DeleteChromeRegistrationKeys(HKEY_LOCAL_MACHINE, |
| 580 suffix, tmp); |
| 564 exit_code = tmp; | 581 exit_code = tmp; |
| 565 return true; | 582 return true; |
| 566 } else if (cmd_line.HasSwitch(installer_util::switches::kInactiveUserToast)) { | 583 } else if (cmd_line.HasSwitch(installer_util::switches::kInactiveUserToast)) { |
| 567 // Launch the inactive user toast experiment. | 584 // Launch the inactive user toast experiment. |
| 568 dist->InactiveUserToastExperiment(); | 585 dist->InactiveUserToastExperiment(); |
| 569 return true; | 586 return true; |
| 570 } | 587 } |
| 571 return false; | 588 return false; |
| 572 } | 589 } |
| 573 | 590 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 } else { | 670 } else { |
| 654 install_status = InstallChrome(parsed_command_line, | 671 install_status = InstallChrome(parsed_command_line, |
| 655 installed_version.get(), | 672 installed_version.get(), |
| 656 prefs.get()); | 673 prefs.get()); |
| 657 } | 674 } |
| 658 | 675 |
| 659 CoUninitialize(); | 676 CoUninitialize(); |
| 660 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 677 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 661 return dist->GetInstallReturnCode(install_status); | 678 return dist->GetInstallReturnCode(install_status); |
| 662 } | 679 } |
| OLD | NEW |