| 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/install.h" | 5 #include "chrome/installer/setup/install.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shlobj.h> | 8 #include <shlobj.h> |
| 9 #include <time.h> | 9 #include <time.h> |
| 10 | 10 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // package. If package does not exist before calling the function | 179 // package. If package does not exist before calling the function |
| 180 // (typical new install), the function creates package during install | 180 // (typical new install), the function creates package during install |
| 181 // and removes the whole directory during rollback. | 181 // and removes the whole directory during rollback. |
| 182 installer::InstallStatus InstallNewVersion( | 182 installer::InstallStatus InstallNewVersion( |
| 183 const InstallationState& original_state, | 183 const InstallationState& original_state, |
| 184 const InstallerState& installer_state, | 184 const InstallerState& installer_state, |
| 185 const base::FilePath& setup_path, | 185 const base::FilePath& setup_path, |
| 186 const base::FilePath& archive_path, | 186 const base::FilePath& archive_path, |
| 187 const base::FilePath& src_path, | 187 const base::FilePath& src_path, |
| 188 const base::FilePath& temp_path, | 188 const base::FilePath& temp_path, |
| 189 const base::Version& new_version, | 189 const Version& new_version, |
| 190 scoped_ptr<base::Version>* current_version) { | 190 scoped_ptr<Version>* current_version) { |
| 191 DCHECK(current_version); | 191 DCHECK(current_version); |
| 192 | 192 |
| 193 installer_state.UpdateStage(installer::BUILDING); | 193 installer_state.UpdateStage(installer::BUILDING); |
| 194 | 194 |
| 195 current_version->reset(installer_state.GetCurrentVersion(original_state)); | 195 current_version->reset(installer_state.GetCurrentVersion(original_state)); |
| 196 scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); | 196 scoped_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); |
| 197 | 197 |
| 198 AddInstallWorkItems(original_state, | 198 AddInstallWorkItems(original_state, |
| 199 installer_state, | 199 installer_state, |
| 200 setup_path, | 200 setup_path, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 299 |
| 300 namespace installer { | 300 namespace installer { |
| 301 | 301 |
| 302 void EscapeXmlAttributeValueInSingleQuotes(base::string16* att_value) { | 302 void EscapeXmlAttributeValueInSingleQuotes(base::string16* att_value) { |
| 303 base::ReplaceChars(*att_value, L"&", L"&", att_value); | 303 base::ReplaceChars(*att_value, L"&", L"&", att_value); |
| 304 base::ReplaceChars(*att_value, L"'", L"'", att_value); | 304 base::ReplaceChars(*att_value, L"'", L"'", att_value); |
| 305 base::ReplaceChars(*att_value, L"<", L"<", att_value); | 305 base::ReplaceChars(*att_value, L"<", L"<", att_value); |
| 306 } | 306 } |
| 307 | 307 |
| 308 bool CreateVisualElementsManifest(const base::FilePath& src_path, | 308 bool CreateVisualElementsManifest(const base::FilePath& src_path, |
| 309 const base::Version& version) { | 309 const Version& version) { |
| 310 // Construct the relative path to the versioned VisualElements directory. | 310 // Construct the relative path to the versioned VisualElements directory. |
| 311 base::string16 elements_dir(ASCIIToUTF16(version.GetString())); | 311 base::string16 elements_dir(ASCIIToUTF16(version.GetString())); |
| 312 elements_dir.push_back(base::FilePath::kSeparators[0]); | 312 elements_dir.push_back(base::FilePath::kSeparators[0]); |
| 313 elements_dir.append(installer::kVisualElements); | 313 elements_dir.append(installer::kVisualElements); |
| 314 | 314 |
| 315 // Some distributions of Chromium may not include visual elements. Only | 315 // Some distributions of Chromium may not include visual elements. Only |
| 316 // proceed if this distribution does. | 316 // proceed if this distribution does. |
| 317 if (!base::PathExists(src_path.Append(elements_dir))) { | 317 if (!base::PathExists(src_path.Append(elements_dir))) { |
| 318 VLOG(1) << "No visual elements found, not writing " | 318 VLOG(1) << "No visual elements found, not writing " |
| 319 << installer::kVisualElementsManifest << " to " << src_path.value(); | 319 << installer::kVisualElementsManifest << " to " << src_path.value(); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 | 500 |
| 501 InstallStatus InstallOrUpdateProduct( | 501 InstallStatus InstallOrUpdateProduct( |
| 502 const InstallationState& original_state, | 502 const InstallationState& original_state, |
| 503 const InstallerState& installer_state, | 503 const InstallerState& installer_state, |
| 504 const base::FilePath& setup_path, | 504 const base::FilePath& setup_path, |
| 505 const base::FilePath& archive_path, | 505 const base::FilePath& archive_path, |
| 506 const base::FilePath& install_temp_path, | 506 const base::FilePath& install_temp_path, |
| 507 const base::FilePath& src_path, | 507 const base::FilePath& src_path, |
| 508 const base::FilePath& prefs_path, | 508 const base::FilePath& prefs_path, |
| 509 const MasterPreferences& prefs, | 509 const MasterPreferences& prefs, |
| 510 const base::Version& new_version) { | 510 const Version& new_version) { |
| 511 DCHECK(!installer_state.products().empty()); | 511 DCHECK(!installer_state.products().empty()); |
| 512 | 512 |
| 513 // TODO(robertshield): Removing the pending on-reboot moves should be done | 513 // TODO(robertshield): Removing the pending on-reboot moves should be done |
| 514 // elsewhere. | 514 // elsewhere. |
| 515 // Remove any scheduled MOVEFILE_DELAY_UNTIL_REBOOT entries in the target of | 515 // Remove any scheduled MOVEFILE_DELAY_UNTIL_REBOOT entries in the target of |
| 516 // this installation. These may have been added during a previous uninstall of | 516 // this installation. These may have been added during a previous uninstall of |
| 517 // the same version. | 517 // the same version. |
| 518 LOG_IF(ERROR, !RemoveFromMovesPendingReboot(installer_state.target_path())) | 518 LOG_IF(ERROR, !RemoveFromMovesPendingReboot(installer_state.target_path())) |
| 519 << "Error accessing pending moves value."; | 519 << "Error accessing pending moves value."; |
| 520 | 520 |
| 521 // Create VisualElementManifest.xml in |src_path| (if required) so that it | 521 // Create VisualElementManifest.xml in |src_path| (if required) so that it |
| 522 // looks as if it had been extracted from the archive when calling | 522 // looks as if it had been extracted from the archive when calling |
| 523 // InstallNewVersion() below. | 523 // InstallNewVersion() below. |
| 524 installer_state.UpdateStage(installer::CREATING_VISUAL_MANIFEST); | 524 installer_state.UpdateStage(installer::CREATING_VISUAL_MANIFEST); |
| 525 CreateVisualElementsManifest(src_path, new_version); | 525 CreateVisualElementsManifest(src_path, new_version); |
| 526 | 526 |
| 527 scoped_ptr<base::Version> existing_version; | 527 scoped_ptr<Version> existing_version; |
| 528 InstallStatus result = InstallNewVersion(original_state, installer_state, | 528 InstallStatus result = InstallNewVersion(original_state, installer_state, |
| 529 setup_path, archive_path, src_path, install_temp_path, new_version, | 529 setup_path, archive_path, src_path, install_temp_path, new_version, |
| 530 &existing_version); | 530 &existing_version); |
| 531 | 531 |
| 532 // TODO(robertshield): Everything below this line should instead be captured | 532 // TODO(robertshield): Everything below this line should instead be captured |
| 533 // by WorkItems. | 533 // by WorkItems. |
| 534 if (!InstallUtil::GetInstallReturnCode(result)) { | 534 if (!InstallUtil::GetInstallReturnCode(result)) { |
| 535 installer_state.UpdateStage(installer::UPDATING_CHANNELS); | 535 installer_state.UpdateStage(installer::UPDATING_CHANNELS); |
| 536 | 536 |
| 537 // Update the modifiers on the channel values for the product(s) being | 537 // Update the modifiers on the channel values for the product(s) being |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 if (app_host_path.empty()) | 702 if (app_host_path.empty()) |
| 703 return false; | 703 return false; |
| 704 | 704 |
| 705 CommandLine cmd(app_host_path); | 705 CommandLine cmd(app_host_path); |
| 706 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); | 706 cmd.AppendSwitchASCII(::switches::kInstallFromWebstore, app_code); |
| 707 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); | 707 VLOG(1) << "App install command: " << cmd.GetCommandLineString(); |
| 708 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); | 708 return base::LaunchProcess(cmd, base::LaunchOptions(), NULL); |
| 709 } | 709 } |
| 710 | 710 |
| 711 } // namespace installer | 711 } // namespace installer |
| OLD | NEW |