OLD | NEW |
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 #include "chrome/installer/setup/setup_main.h" | 5 #include "chrome/installer/setup/setup_main.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <msi.h> | 8 #include <msi.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 shortcut_properties.set_pin_to_taskbar(true); | 887 shortcut_properties.set_pin_to_taskbar(true); |
888 shortcut_properties.set_pin_to_start(true); | 888 shortcut_properties.set_pin_to_start(true); |
889 ShellUtil::CreateOrUpdateShortcut( | 889 ShellUtil::CreateOrUpdateShortcut( |
890 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, chrome_dist, | 890 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, chrome_dist, |
891 shortcut_properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS); | 891 shortcut_properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS); |
892 | 892 |
893 // Register Chrome at user-level and make it default. | 893 // Register Chrome at user-level and make it default. |
894 scoped_ptr<WorkItemList> delegate_execute_list( | 894 scoped_ptr<WorkItemList> delegate_execute_list( |
895 WorkItem::CreateWorkItemList()); | 895 WorkItem::CreateWorkItemList()); |
896 installer::AddDelegateExecuteWorkItems( | 896 installer::AddDelegateExecuteWorkItems( |
897 installer_state, chrome_exe.DirName(), base::Version(), chrome, | 897 installer_state, chrome_exe.DirName(), Version(), chrome, |
898 delegate_execute_list.get()); | 898 delegate_execute_list.get()); |
899 delegate_execute_list->Do(); | 899 delegate_execute_list->Do(); |
900 if (ShellUtil::CanMakeChromeDefaultUnattended()) { | 900 if (ShellUtil::CanMakeChromeDefaultUnattended()) { |
901 ShellUtil::MakeChromeDefault(chrome_dist, ShellUtil::CURRENT_USER, | 901 ShellUtil::MakeChromeDefault(chrome_dist, ShellUtil::CURRENT_USER, |
902 chrome_exe, true); | 902 chrome_exe, true); |
903 } else { | 903 } else { |
904 ShellUtil::ShowMakeChromeDefaultSystemUI(chrome_dist, chrome_exe); | 904 ShellUtil::ShowMakeChromeDefaultSystemUI(chrome_dist, chrome_exe); |
905 } | 905 } |
906 } else { | 906 } else { |
907 LOG(ERROR) << "Path not found: " << chrome_exe.value(); | 907 LOG(ERROR) << "Path not found: " << chrome_exe.value(); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 } | 1118 } |
1119 } | 1119 } |
1120 } else if (cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { | 1120 } else if (cmd_line.HasSwitch(installer::switches::kSystemLevelToast)) { |
1121 const Products& products = installer_state->products(); | 1121 const Products& products = installer_state->products(); |
1122 for (Products::const_iterator it = products.begin(); it < products.end(); | 1122 for (Products::const_iterator it = products.begin(); it < products.end(); |
1123 ++it) { | 1123 ++it) { |
1124 const Product& product = **it; | 1124 const Product& product = **it; |
1125 BrowserDistribution* browser_dist = product.distribution(); | 1125 BrowserDistribution* browser_dist = product.distribution(); |
1126 // We started as system-level and have been re-launched as user level | 1126 // We started as system-level and have been re-launched as user level |
1127 // to continue with the toast experiment. | 1127 // to continue with the toast experiment. |
1128 base::Version installed_version; | 1128 Version installed_version; |
1129 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); | 1129 InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); |
1130 if (!installed_version.IsValid()) { | 1130 if (!installed_version.IsValid()) { |
1131 LOG(ERROR) << "No installation of " | 1131 LOG(ERROR) << "No installation of " |
1132 << browser_dist->GetDisplayName() | 1132 << browser_dist->GetDisplayName() |
1133 << " found for system-level toast."; | 1133 << " found for system-level toast."; |
1134 } else { | 1134 } else { |
1135 product.LaunchUserExperiment( | 1135 product.LaunchUserExperiment( |
1136 setup_exe, installer::REENTRY_SYS_UPDATE, true); | 1136 setup_exe, installer::REENTRY_SYS_UPDATE, true); |
1137 } | 1137 } |
1138 } | 1138 } |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 unpack_path.value(), | 1382 unpack_path.value(), |
1383 NULL)) { | 1383 NULL)) { |
1384 installer_state.WriteInstallerResult( | 1384 installer_state.WriteInstallerResult( |
1385 UNPACKING_FAILED, | 1385 UNPACKING_FAILED, |
1386 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, | 1386 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, |
1387 NULL); | 1387 NULL); |
1388 return UNPACKING_FAILED; | 1388 return UNPACKING_FAILED; |
1389 } | 1389 } |
1390 | 1390 |
1391 VLOG(1) << "unpacked to " << unpack_path.value(); | 1391 VLOG(1) << "unpacked to " << unpack_path.value(); |
1392 base::FilePath src_path(unpack_path.Append(kInstallSourceChromeDir)); | 1392 base::FilePath src_path( |
1393 scoped_ptr<base::Version> | 1393 unpack_path.Append(kInstallSourceChromeDir)); |
| 1394 scoped_ptr<Version> |
1394 installer_version(GetMaxVersionFromArchiveDir(src_path)); | 1395 installer_version(GetMaxVersionFromArchiveDir(src_path)); |
1395 if (!installer_version.get()) { | 1396 if (!installer_version.get()) { |
1396 LOG(ERROR) << "Did not find any valid version in installer."; | 1397 LOG(ERROR) << "Did not find any valid version in installer."; |
1397 install_status = INVALID_ARCHIVE; | 1398 install_status = INVALID_ARCHIVE; |
1398 installer_state.WriteInstallerResult(install_status, | 1399 installer_state.WriteInstallerResult(install_status, |
1399 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); | 1400 IDS_INSTALL_INVALID_ARCHIVE_BASE, NULL); |
1400 } else { | 1401 } else { |
1401 VLOG(1) << "version to install: " << installer_version->GetString(); | 1402 VLOG(1) << "version to install: " << installer_version->GetString(); |
1402 bool proceed_with_installation = true; | 1403 bool proceed_with_installation = true; |
1403 | 1404 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1710 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
1710 // to pass through, since this is only returned on uninstall which is | 1711 // to pass through, since this is only returned on uninstall which is |
1711 // never invoked directly by Google Update. | 1712 // never invoked directly by Google Update. |
1712 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1713 return_code = InstallUtil::GetInstallReturnCode(install_status); |
1713 } | 1714 } |
1714 | 1715 |
1715 VLOG(1) << "Installation complete, returning: " << return_code; | 1716 VLOG(1) << "Installation complete, returning: " << return_code; |
1716 | 1717 |
1717 return return_code; | 1718 return return_code; |
1718 } | 1719 } |
OLD | NEW |