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

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

Issue 2258243002: Consistently use namespaced base::Version in chrome/installer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « chrome/installer/setup/install.h ('k') | chrome/installer/setup/install_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 "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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // package. If package does not exist before calling the function 176 // package. If package does not exist before calling the function
177 // (typical new install), the function creates package during install 177 // (typical new install), the function creates package during install
178 // and removes the whole directory during rollback. 178 // and removes the whole directory during rollback.
179 installer::InstallStatus InstallNewVersion( 179 installer::InstallStatus InstallNewVersion(
180 const installer::InstallationState& original_state, 180 const installer::InstallationState& original_state,
181 const installer::InstallerState& installer_state, 181 const installer::InstallerState& installer_state,
182 const base::FilePath& setup_path, 182 const base::FilePath& setup_path,
183 const base::FilePath& archive_path, 183 const base::FilePath& archive_path,
184 const base::FilePath& src_path, 184 const base::FilePath& src_path,
185 const base::FilePath& temp_path, 185 const base::FilePath& temp_path,
186 const Version& new_version, 186 const base::Version& new_version,
187 std::unique_ptr<Version>* current_version, 187 std::unique_ptr<base::Version>* current_version,
188 bool is_downgrade_allowed) { 188 bool is_downgrade_allowed) {
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 installer::SetCurrentVersionCrashKey(current_version->get()); 194 installer::SetCurrentVersionCrashKey(current_version->get());
195 195
196 std::unique_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList()); 196 std::unique_ptr<WorkItemList> install_list(WorkItem::CreateWorkItemList());
197 197
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 void EscapeXmlAttributeValueInSingleQuotes(base::string16* att_value) { 361 void EscapeXmlAttributeValueInSingleQuotes(base::string16* att_value) {
362 base::ReplaceChars(*att_value, base::ASCIIToUTF16("&"), 362 base::ReplaceChars(*att_value, base::ASCIIToUTF16("&"),
363 base::ASCIIToUTF16("&amp;"), att_value); 363 base::ASCIIToUTF16("&amp;"), att_value);
364 base::ReplaceChars(*att_value, base::ASCIIToUTF16("'"), 364 base::ReplaceChars(*att_value, base::ASCIIToUTF16("'"),
365 base::ASCIIToUTF16("&apos;"), att_value); 365 base::ASCIIToUTF16("&apos;"), att_value);
366 base::ReplaceChars(*att_value, base::ASCIIToUTF16("<"), 366 base::ReplaceChars(*att_value, base::ASCIIToUTF16("<"),
367 base::ASCIIToUTF16("&lt;"), att_value); 367 base::ASCIIToUTF16("&lt;"), att_value);
368 } 368 }
369 369
370 bool CreateVisualElementsManifest(const base::FilePath& src_path, 370 bool CreateVisualElementsManifest(const base::FilePath& src_path,
371 const Version& version) { 371 const base::Version& version) {
372 // Construct the relative path to the versioned VisualElements directory. 372 // Construct the relative path to the versioned VisualElements directory.
373 base::string16 elements_dir(base::ASCIIToUTF16(version.GetString())); 373 base::string16 elements_dir(base::ASCIIToUTF16(version.GetString()));
374 elements_dir.push_back(base::FilePath::kSeparators[0]); 374 elements_dir.push_back(base::FilePath::kSeparators[0]);
375 elements_dir.append(installer::kVisualElements); 375 elements_dir.append(installer::kVisualElements);
376 376
377 // Some distributions of Chromium may not include visual elements. Only 377 // Some distributions of Chromium may not include visual elements. Only
378 // proceed if this distribution does. 378 // proceed if this distribution does.
379 if (!base::PathExists(src_path.Append(elements_dir))) { 379 if (!base::PathExists(src_path.Append(elements_dir))) {
380 VLOG(1) << "No visual elements found, not writing " 380 VLOG(1) << "No visual elements found, not writing "
381 << installer::kVisualElementsManifest << " to " << src_path.value(); 381 << installer::kVisualElementsManifest << " to " << src_path.value();
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 571
572 InstallStatus InstallOrUpdateProduct( 572 InstallStatus InstallOrUpdateProduct(
573 const installer::InstallationState& original_state, 573 const installer::InstallationState& original_state,
574 const installer::InstallerState& installer_state, 574 const installer::InstallerState& installer_state,
575 const base::FilePath& setup_path, 575 const base::FilePath& setup_path,
576 const base::FilePath& archive_path, 576 const base::FilePath& archive_path,
577 const base::FilePath& install_temp_path, 577 const base::FilePath& install_temp_path,
578 const base::FilePath& src_path, 578 const base::FilePath& src_path,
579 const base::FilePath& prefs_path, 579 const base::FilePath& prefs_path,
580 const MasterPreferences& prefs, 580 const MasterPreferences& prefs,
581 const Version& new_version) { 581 const base::Version& new_version) {
582 DCHECK(!installer_state.products().empty()); 582 DCHECK(!installer_state.products().empty());
583 583
584 // TODO(robertshield): Removing the pending on-reboot moves should be done 584 // TODO(robertshield): Removing the pending on-reboot moves should be done
585 // elsewhere. 585 // elsewhere.
586 // Remove any scheduled MOVEFILE_DELAY_UNTIL_REBOOT entries in the target of 586 // Remove any scheduled MOVEFILE_DELAY_UNTIL_REBOOT entries in the target of
587 // this installation. These may have been added during a previous uninstall of 587 // this installation. These may have been added during a previous uninstall of
588 // the same version. 588 // the same version.
589 LOG_IF(ERROR, !RemoveFromMovesPendingReboot(installer_state.target_path())) 589 LOG_IF(ERROR, !RemoveFromMovesPendingReboot(installer_state.target_path()))
590 << "Error accessing pending moves value."; 590 << "Error accessing pending moves value.";
591 591
592 // Create VisualElementManifest.xml in |src_path| (if required) so that it 592 // Create VisualElementManifest.xml in |src_path| (if required) so that it
593 // looks as if it had been extracted from the archive when calling 593 // looks as if it had been extracted from the archive when calling
594 // InstallNewVersion() below. 594 // InstallNewVersion() below.
595 installer_state.UpdateStage(installer::CREATING_VISUAL_MANIFEST); 595 installer_state.UpdateStage(installer::CREATING_VISUAL_MANIFEST);
596 CreateVisualElementsManifest(src_path, new_version); 596 CreateVisualElementsManifest(src_path, new_version);
597 597
598 std::unique_ptr<Version> existing_version; 598 std::unique_ptr<base::Version> existing_version;
599 InstallStatus result = 599 InstallStatus result =
600 InstallNewVersion(original_state, installer_state, setup_path, 600 InstallNewVersion(original_state, installer_state, setup_path,
601 archive_path, src_path, install_temp_path, new_version, 601 archive_path, src_path, install_temp_path, new_version,
602 &existing_version, IsDowngradeAllowed(prefs)); 602 &existing_version, IsDowngradeAllowed(prefs));
603 603
604 // TODO(robertshield): Everything below this line should instead be captured 604 // TODO(robertshield): Everything below this line should instead be captured
605 // by WorkItems. 605 // by WorkItems.
606 if (!InstallUtil::GetInstallReturnCode(result)) { 606 if (!InstallUtil::GetInstallReturnCode(result)) {
607 installer_state.UpdateStage(installer::UPDATING_CHANNELS); 607 installer_state.UpdateStage(installer::UPDATING_CHANNELS);
608 608
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 // Read master_preferences copied beside chrome.exe at install. 780 // Read master_preferences copied beside chrome.exe at install.
781 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs)); 781 MasterPreferences prefs(installation_root.AppendASCII(kDefaultMasterPrefs));
782 base::FilePath chrome_exe(installation_root.Append(kChromeExe)); 782 base::FilePath chrome_exe(installation_root.Append(kChromeExe));
783 CreateOrUpdateShortcuts( 783 CreateOrUpdateShortcuts(
784 chrome_exe, chrome, prefs, CURRENT_USER, install_operation); 784 chrome_exe, chrome, prefs, CURRENT_USER, install_operation);
785 785
786 UpdateDefaultBrowserBeaconForPath(chrome_exe); 786 UpdateDefaultBrowserBeaconForPath(chrome_exe);
787 } 787 }
788 788
789 } // namespace installer 789 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/install.h ('k') | chrome/installer/setup/install_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698