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