| 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> |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/at_exit.h" | 14 #include "base/at_exit.h" |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/file_util.h" | 17 #include "base/file_util.h" |
| 18 #include "base/file_version_info.h" | 18 #include "base/file_version_info.h" |
| 19 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
| 20 #include "base/files/scoped_temp_dir.h" | 20 #include "base/files/scoped_temp_dir.h" |
| 21 #include "base/memory/scoped_ptr.h" |
| 21 #include "base/path_service.h" | 22 #include "base/path_service.h" |
| 22 #include "base/process/launch.h" | 23 #include "base/process/launch.h" |
| 23 #include "base/strings/string16.h" | 24 #include "base/strings/string16.h" |
| 24 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
| 25 #include "base/strings/string_util.h" | 26 #include "base/strings/string_util.h" |
| 26 #include "base/strings/stringprintf.h" | 27 #include "base/strings/stringprintf.h" |
| 27 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
| 28 #include "base/values.h" | 29 #include "base/values.h" |
| 29 #include "base/win/registry.h" | 30 #include "base/win/registry.h" |
| 30 #include "base/win/scoped_com_initializer.h" | 31 #include "base/win/scoped_com_initializer.h" |
| (...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1271 L"Chrome Installer"); | 1272 L"Chrome Installer"); |
| 1272 static google_breakpad::CustomInfoEntry entries[] = { | 1273 static google_breakpad::CustomInfoEntry entries[] = { |
| 1273 ver_entry, prod_entry, plat_entry, type_entry }; | 1274 ver_entry, prod_entry, plat_entry, type_entry }; |
| 1274 static google_breakpad::CustomClientInfo custom_info = { | 1275 static google_breakpad::CustomClientInfo custom_info = { |
| 1275 entries, arraysize(entries) }; | 1276 entries, arraysize(entries) }; |
| 1276 return &custom_info; | 1277 return &custom_info; |
| 1277 } | 1278 } |
| 1278 | 1279 |
| 1279 // Initialize crash reporting for this process. This involves connecting to | 1280 // Initialize crash reporting for this process. This involves connecting to |
| 1280 // breakpad, etc. | 1281 // breakpad, etc. |
| 1281 google_breakpad::ExceptionHandler* InitializeCrashReporting( | 1282 scoped_ptr<google_breakpad::ExceptionHandler> InitializeCrashReporting( |
| 1282 bool system_install) { | 1283 bool system_install) { |
| 1283 // Only report crashes if the user allows it. | 1284 // Only report crashes if the user allows it. |
| 1284 if (!GoogleUpdateSettings::GetCollectStatsConsent()) | 1285 if (!GoogleUpdateSettings::GetCollectStatsConsent()) |
| 1285 return NULL; | 1286 return scoped_ptr<google_breakpad::ExceptionHandler>(); |
| 1286 | 1287 |
| 1287 // Get the alternate dump directory. We use the temp path. | 1288 // Get the alternate dump directory. We use the temp path. |
| 1288 base::FilePath temp_directory; | 1289 base::FilePath temp_directory; |
| 1289 if (!base::GetTempDir(&temp_directory) || temp_directory.empty()) | 1290 if (!base::GetTempDir(&temp_directory) || temp_directory.empty()) |
| 1290 return NULL; | 1291 return scoped_ptr<google_breakpad::ExceptionHandler>(); |
| 1291 | 1292 |
| 1292 wchar_t exe_path[MAX_PATH * 2] = {0}; | 1293 wchar_t exe_path[MAX_PATH * 2] = {0}; |
| 1293 GetModuleFileName(NULL, exe_path, arraysize(exe_path)); | 1294 GetModuleFileName(NULL, exe_path, arraysize(exe_path)); |
| 1294 | 1295 |
| 1295 // Build the pipe name. It can be either: | 1296 // Build the pipe name. It can be either: |
| 1296 // System-wide install: "NamedPipe\GoogleCrashServices\S-1-5-18" | 1297 // System-wide install: "NamedPipe\GoogleCrashServices\S-1-5-18" |
| 1297 // Per-user install: "NamedPipe\GoogleCrashServices\<user SID>" | 1298 // Per-user install: "NamedPipe\GoogleCrashServices\<user SID>" |
| 1298 base::string16 user_sid = kSystemPrincipalSid; | 1299 base::string16 user_sid = kSystemPrincipalSid; |
| 1299 | 1300 |
| 1300 if (!system_install) { | 1301 if (!system_install) { |
| 1301 if (!base::win::GetUserSidString(&user_sid)) { | 1302 if (!base::win::GetUserSidString(&user_sid)) { |
| 1302 return NULL; | 1303 return scoped_ptr<google_breakpad::ExceptionHandler>(); |
| 1303 } | 1304 } |
| 1304 } | 1305 } |
| 1305 | 1306 |
| 1306 base::string16 pipe_name = kGoogleUpdatePipeName; | 1307 base::string16 pipe_name = kGoogleUpdatePipeName; |
| 1307 pipe_name += user_sid; | 1308 pipe_name += user_sid; |
| 1308 | 1309 |
| 1309 google_breakpad::ExceptionHandler* breakpad = | 1310 return scoped_ptr<google_breakpad::ExceptionHandler>( |
| 1310 new google_breakpad::ExceptionHandler( | 1311 new google_breakpad::ExceptionHandler( |
| 1311 temp_directory.value(), NULL, NULL, NULL, | 1312 temp_directory.value(), NULL, NULL, NULL, |
| 1312 google_breakpad::ExceptionHandler::HANDLER_ALL, kLargerDumpType, | 1313 google_breakpad::ExceptionHandler::HANDLER_ALL, kLargerDumpType, |
| 1313 pipe_name.c_str(), GetCustomInfo(exe_path)); | 1314 pipe_name.c_str(), GetCustomInfo(exe_path))); |
| 1314 return breakpad; | |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 // Uninstalls multi-install Chrome Frame if the current operation is a | 1317 // Uninstalls multi-install Chrome Frame if the current operation is a |
| 1318 // multi-install install or update. The operation is performed directly rather | 1318 // multi-install install or update. The operation is performed directly rather |
| 1319 // than delegated to the existing install since there is no facility in older | 1319 // than delegated to the existing install since there is no facility in older |
| 1320 // versions of setup.exe to uninstall GCF without touching the binaries. The | 1320 // versions of setup.exe to uninstall GCF without touching the binaries. The |
| 1321 // binaries will be uninstalled during later processing if they are not in-use | 1321 // binaries will be uninstalled during later processing if they are not in-use |
| 1322 // (see UninstallBinariesIfUnused). |original_state| and |installer_state| are | 1322 // (see UninstallBinariesIfUnused). |original_state| and |installer_state| are |
| 1323 // updated to reflect the state of the world following the operation. | 1323 // updated to reflect the state of the world following the operation. |
| 1324 void UninstallMultiChromeFrameIfPresent(const CommandLine& cmd_line, | 1324 void UninstallMultiChromeFrameIfPresent(const CommandLine& cmd_line, |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1688 installer::InitInstallerLogging(prefs); | 1688 installer::InitInstallerLogging(prefs); |
| 1689 | 1689 |
| 1690 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); | 1690 const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); |
| 1691 VLOG(1) << "Command Line: " << cmd_line.GetCommandLineString(); | 1691 VLOG(1) << "Command Line: " << cmd_line.GetCommandLineString(); |
| 1692 | 1692 |
| 1693 VLOG(1) << "multi install is " << prefs.is_multi_install(); | 1693 VLOG(1) << "multi install is " << prefs.is_multi_install(); |
| 1694 bool system_install = false; | 1694 bool system_install = false; |
| 1695 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); | 1695 prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install); |
| 1696 VLOG(1) << "system install is " << system_install; | 1696 VLOG(1) << "system install is " << system_install; |
| 1697 | 1697 |
| 1698 google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad( | 1698 scoped_ptr<google_breakpad::ExceptionHandler> breakpad( |
| 1699 InitializeCrashReporting(system_install)); | 1699 InitializeCrashReporting(system_install)); |
| 1700 | 1700 |
| 1701 InstallationState original_state; | 1701 InstallationState original_state; |
| 1702 original_state.Initialize(); | 1702 original_state.Initialize(); |
| 1703 | 1703 |
| 1704 InstallerState installer_state; | 1704 InstallerState installer_state; |
| 1705 installer_state.Initialize(cmd_line, prefs, original_state); | 1705 installer_state.Initialize(cmd_line, prefs, original_state); |
| 1706 const bool is_uninstall = cmd_line.HasSwitch(installer::switches::kUninstall); | 1706 const bool is_uninstall = cmd_line.HasSwitch(installer::switches::kUninstall); |
| 1707 | 1707 |
| 1708 // Check to make sure current system is WinXP or later. If not, log | 1708 // Check to make sure current system is WinXP or later. If not, log |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1804 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT | 1804 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT |
| 1805 // to pass through, since this is only returned on uninstall which is | 1805 // to pass through, since this is only returned on uninstall which is |
| 1806 // never invoked directly by Google Update. | 1806 // never invoked directly by Google Update. |
| 1807 return_code = InstallUtil::GetInstallReturnCode(install_status); | 1807 return_code = InstallUtil::GetInstallReturnCode(install_status); |
| 1808 } | 1808 } |
| 1809 | 1809 |
| 1810 VLOG(1) << "Installation complete, returning: " << return_code; | 1810 VLOG(1) << "Installation complete, returning: " << return_code; |
| 1811 | 1811 |
| 1812 return return_code; | 1812 return return_code; |
| 1813 } | 1813 } |
| OLD | NEW |