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

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

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months 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_worker.cc ('k') | chrome/installer/setup/setup_util_unittest.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 #include <windows.h> 5 #include <windows.h>
6 #include <msi.h> 6 #include <msi.h>
7 #include <shellapi.h> 7 #include <shellapi.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return ret; 114 return ret;
115 115
116 base::FilePath uncompressed_archive( 116 base::FilePath uncompressed_archive(
117 temp_path.Append(installer::kChromeArchive)); 117 temp_path.Append(installer::kChromeArchive));
118 scoped_ptr<Version> archive_version( 118 scoped_ptr<Version> archive_version(
119 installer::GetMaxVersionFromArchiveDir(installer_state.target_path())); 119 installer::GetMaxVersionFromArchiveDir(installer_state.target_path()));
120 120
121 // Check if this is differential update and if it is, patch it to the 121 // Check if this is differential update and if it is, patch it to the
122 // installer archive that should already be on the machine. We assume 122 // installer archive that should already be on the machine. We assume
123 // it is a differential installer if chrome.7z is not found. 123 // it is a differential installer if chrome.7z is not found.
124 if (!file_util::PathExists(uncompressed_archive)) { 124 if (!base::PathExists(uncompressed_archive)) {
125 *archive_type = installer::INCREMENTAL_ARCHIVE_TYPE; 125 *archive_type = installer::INCREMENTAL_ARCHIVE_TYPE;
126 VLOG(1) << "Differential patch found. Applying to existing archive."; 126 VLOG(1) << "Differential patch found. Applying to existing archive.";
127 if (!archive_version.get()) { 127 if (!archive_version.get()) {
128 LOG(ERROR) << "Can not use differential update when Chrome is not " 128 LOG(ERROR) << "Can not use differential update when Chrome is not "
129 << "installed on the system."; 129 << "installed on the system.";
130 return installer::CHROME_NOT_INSTALLED; 130 return installer::CHROME_NOT_INSTALLED;
131 } 131 }
132 132
133 base::FilePath existing_archive(installer_state.target_path().AppendASCII( 133 base::FilePath existing_archive(installer_state.target_path().AppendASCII(
134 archive_version->GetString())); 134 archive_version->GetString()));
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 installer_state.WriteInstallerResult(installer::TEMP_DIR_FAILED, 676 installer_state.WriteInstallerResult(installer::TEMP_DIR_FAILED,
677 IDS_INSTALL_TEMP_DIR_FAILED_BASE, NULL); 677 IDS_INSTALL_TEMP_DIR_FAILED_BASE, NULL);
678 return installer::TEMP_DIR_FAILED; 678 return installer::TEMP_DIR_FAILED;
679 } 679 }
680 680
681 bool unpacked = false; 681 bool unpacked = false;
682 682
683 // We want to keep uncompressed archive (chrome.7z) that we get after 683 // We want to keep uncompressed archive (chrome.7z) that we get after
684 // uncompressing and binary patching. Get the location for this file. 684 // uncompressing and binary patching. Get the location for this file.
685 base::FilePath archive_to_copy; 685 base::FilePath archive_to_copy;
686 if (file_util::PathExists(archive)) { 686 if (base::PathExists(archive)) {
687 VLOG(1) << "Archive found to install Chrome " << archive.value(); 687 VLOG(1) << "Archive found to install Chrome " << archive.value();
688 if (UnPackArchive(archive, installer_state, temp_path.path(), unpack_path, 688 if (UnPackArchive(archive, installer_state, temp_path.path(), unpack_path,
689 archive_type)) { 689 archive_type)) {
690 install_status = (*archive_type) == installer::INCREMENTAL_ARCHIVE_TYPE ? 690 install_status = (*archive_type) == installer::INCREMENTAL_ARCHIVE_TYPE ?
691 installer::APPLY_DIFF_PATCH_FAILED : installer::UNCOMPRESSION_FAILED; 691 installer::APPLY_DIFF_PATCH_FAILED : installer::UNCOMPRESSION_FAILED;
692 installer_state.WriteInstallerResult( 692 installer_state.WriteInstallerResult(
693 install_status, 693 install_status,
694 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, 694 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE,
695 NULL); 695 NULL);
696 } else { 696 } else {
697 unpacked = true; 697 unpacked = true;
698 archive_to_copy = temp_path.path().Append(installer::kChromeArchive); 698 archive_to_copy = temp_path.path().Append(installer::kChromeArchive);
699 } 699 }
700 } else { 700 } else {
701 base::FilePath uncompressed_archive(cmd_line.GetProgram().DirName().Append( 701 base::FilePath uncompressed_archive(cmd_line.GetProgram().DirName().Append(
702 installer::kChromeArchive)); 702 installer::kChromeArchive));
703 703
704 if (file_util::PathExists(uncompressed_archive)) { 704 if (base::PathExists(uncompressed_archive)) {
705 VLOG(1) << "Uncompressed archive found to install Chrome " 705 VLOG(1) << "Uncompressed archive found to install Chrome "
706 << uncompressed_archive.value(); 706 << uncompressed_archive.value();
707 *archive_type = installer::FULL_ARCHIVE_TYPE; 707 *archive_type = installer::FULL_ARCHIVE_TYPE;
708 string16 unpacked_file; 708 string16 unpacked_file;
709 if (LzmaUtil::UnPackArchive(uncompressed_archive.value(), 709 if (LzmaUtil::UnPackArchive(uncompressed_archive.value(),
710 unpack_path.value(), &unpacked_file)) { 710 unpack_path.value(), &unpacked_file)) {
711 installer_state.WriteInstallerResult( 711 installer_state.WriteInstallerResult(
712 installer::UNCOMPRESSION_FAILED, 712 installer::UNCOMPRESSION_FAILED,
713 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE, 713 IDS_INSTALL_UNCOMPRESSION_FAILED_BASE,
714 NULL); 714 NULL);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 !installer_state.system_install()) { 1050 !installer_state.system_install()) {
1051 BrowserDistribution* dist = chrome->distribution(); 1051 BrowserDistribution* dist = chrome->distribution();
1052 const base::FilePath system_exe_path( 1052 const base::FilePath system_exe_path(
1053 installer::GetChromeInstallPath(true, dist) 1053 installer::GetChromeInstallPath(true, dist)
1054 .Append(installer::kChromeExe)); 1054 .Append(installer::kChromeExe));
1055 system_level_cmd.SetProgram(system_exe_path); 1055 system_level_cmd.SetProgram(system_exe_path);
1056 1056
1057 base::FilePath first_run_sentinel; 1057 base::FilePath first_run_sentinel;
1058 InstallUtil::GetSentinelFilePath( 1058 InstallUtil::GetSentinelFilePath(
1059 chrome::kFirstRunSentinel, dist, &first_run_sentinel); 1059 chrome::kFirstRunSentinel, dist, &first_run_sentinel);
1060 if (file_util::PathExists(first_run_sentinel)) { 1060 if (base::PathExists(first_run_sentinel)) {
1061 // If the Chrome being self-destructed has already undergone First Run, 1061 // If the Chrome being self-destructed has already undergone First Run,
1062 // trigger Active Setup and make sure the system-level Chrome doesn't go 1062 // trigger Active Setup and make sure the system-level Chrome doesn't go
1063 // through first run. 1063 // through first run.
1064 trigger_active_setup = true; 1064 trigger_active_setup = true;
1065 system_level_cmd.AppendSwitch(::switches::kNoFirstRun); 1065 system_level_cmd.AppendSwitch(::switches::kNoFirstRun);
1066 } 1066 }
1067 } 1067 }
1068 } 1068 }
1069 if (installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES)) { 1069 if (installer_state.FindProduct(BrowserDistribution::CHROME_BINARIES)) {
1070 // Chrome Binaries should be last; if something else is cancelled, they 1070 // Chrome Binaries should be last; if something else is cancelled, they
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 } 1197 }
1198 1198
1199 base::FilePath chrome_exe( 1199 base::FilePath chrome_exe(
1200 cmd_line.GetSwitchValuePath(installer::switches::kRegisterDevChrome)); 1200 cmd_line.GetSwitchValuePath(installer::switches::kRegisterDevChrome));
1201 if (chrome_exe.empty()) 1201 if (chrome_exe.empty())
1202 chrome_exe = cmd_line.GetProgram().DirName().Append(installer::kChromeExe); 1202 chrome_exe = cmd_line.GetProgram().DirName().Append(installer::kChromeExe);
1203 if (!chrome_exe.IsAbsolute()) 1203 if (!chrome_exe.IsAbsolute())
1204 chrome_exe = base::MakeAbsoluteFilePath(chrome_exe); 1204 chrome_exe = base::MakeAbsoluteFilePath(chrome_exe);
1205 1205
1206 installer::InstallStatus status = installer::FIRST_INSTALL_SUCCESS; 1206 installer::InstallStatus status = installer::FIRST_INSTALL_SUCCESS;
1207 if (file_util::PathExists(chrome_exe)) { 1207 if (base::PathExists(chrome_exe)) {
1208 Product chrome(chrome_dist); 1208 Product chrome(chrome_dist);
1209 1209
1210 // Create the Start menu shortcut and pin it to the taskbar. 1210 // Create the Start menu shortcut and pin it to the taskbar.
1211 ShellUtil::ShortcutProperties shortcut_properties(ShellUtil::CURRENT_USER); 1211 ShellUtil::ShortcutProperties shortcut_properties(ShellUtil::CURRENT_USER);
1212 chrome.AddDefaultShortcutProperties(chrome_exe, &shortcut_properties); 1212 chrome.AddDefaultShortcutProperties(chrome_exe, &shortcut_properties);
1213 shortcut_properties.set_dual_mode(true); 1213 shortcut_properties.set_dual_mode(true);
1214 shortcut_properties.set_pin_to_taskbar(true); 1214 shortcut_properties.set_pin_to_taskbar(true);
1215 ShellUtil::CreateOrUpdateShortcut( 1215 ShellUtil::CreateOrUpdateShortcut(
1216 ShellUtil::SHORTCUT_LOCATION_START_MENU, chrome_dist, 1216 ShellUtil::SHORTCUT_LOCATION_START_MENU, chrome_dist,
1217 shortcut_properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS); 1217 shortcut_properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS);
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 if (!(installer_state.is_msi() && is_uninstall)) 1752 if (!(installer_state.is_msi() && is_uninstall))
1753 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT 1753 // Note that we allow the status installer::UNINSTALL_REQUIRES_REBOOT
1754 // to pass through, since this is only returned on uninstall which is 1754 // to pass through, since this is only returned on uninstall which is
1755 // never invoked directly by Google Update. 1755 // never invoked directly by Google Update.
1756 return_code = InstallUtil::GetInstallReturnCode(install_status); 1756 return_code = InstallUtil::GetInstallReturnCode(install_status);
1757 1757
1758 VLOG(1) << "Installation complete, returning: " << return_code; 1758 VLOG(1) << "Installation complete, returning: " << return_code;
1759 1759
1760 return return_code; 1760 return return_code;
1761 } 1761 }
OLDNEW
« no previous file with comments | « chrome/installer/setup/install_worker.cc ('k') | chrome/installer/setup/setup_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698