| 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/util/installer_state.h" | 5 #include "chrome/installer/util/installer_state.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <functional> | 8 #include <functional> | 
| 9 #include <utility> | 9 #include <utility> | 
| 10 | 10 | 
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 339     default: | 339     default: | 
| 340       DCHECK(type == UNKNOWN_PACKAGE_TYPE); | 340       DCHECK(type == UNKNOWN_PACKAGE_TYPE); | 
| 341       package_type_ = UNKNOWN_PACKAGE_TYPE; | 341       package_type_ = UNKNOWN_PACKAGE_TYPE; | 
| 342       multi_package_distribution_ = NULL; | 342       multi_package_distribution_ = NULL; | 
| 343       break; | 343       break; | 
| 344   } | 344   } | 
| 345 } | 345 } | 
| 346 | 346 | 
| 347 // Returns the Chrome binaries directory for multi-install or |dist|'s directory | 347 // Returns the Chrome binaries directory for multi-install or |dist|'s directory | 
| 348 // otherwise. | 348 // otherwise. | 
| 349 FilePath InstallerState::GetDefaultProductInstallPath( | 349 base::FilePath InstallerState::GetDefaultProductInstallPath( | 
| 350     BrowserDistribution* dist) const { | 350     BrowserDistribution* dist) const { | 
| 351   DCHECK(dist); | 351   DCHECK(dist); | 
| 352   DCHECK(package_type_ != UNKNOWN_PACKAGE_TYPE); | 352   DCHECK(package_type_ != UNKNOWN_PACKAGE_TYPE); | 
| 353 | 353 | 
| 354   if (package_type_ == SINGLE_PACKAGE) { | 354   if (package_type_ == SINGLE_PACKAGE) { | 
| 355     return GetChromeInstallPath(system_install(), dist); | 355     return GetChromeInstallPath(system_install(), dist); | 
| 356   } else { | 356   } else { | 
| 357     return GetChromeInstallPath(system_install(), | 357     return GetChromeInstallPath(system_install(), | 
| 358         BrowserDistribution::GetSpecificDistribution( | 358         BrowserDistribution::GetSpecificDistribution( | 
| 359             BrowserDistribution::CHROME_BINARIES)); | 359             BrowserDistribution::CHROME_BINARIES)); | 
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 590   if (current_version != NULL) { | 590   if (current_version != NULL) { | 
| 591     base::FilePath cf_install_path( | 591     base::FilePath cf_install_path( | 
| 592         target_path().AppendASCII(current_version->GetString()) | 592         target_path().AppendASCII(current_version->GetString()) | 
| 593                      .Append(kChromeFrameDll)); | 593                      .Append(kChromeFrameDll)); | 
| 594     in_use = file_util::PathExists(cf_install_path) && | 594     in_use = file_util::PathExists(cf_install_path) && | 
| 595         IsFileInUse(cf_install_path); | 595         IsFileInUse(cf_install_path); | 
| 596   } | 596   } | 
| 597   return in_use; | 597   return in_use; | 
| 598 } | 598 } | 
| 599 | 599 | 
| 600 FilePath InstallerState::GetInstallerDirectory(const Version& version) const { | 600 base::FilePath InstallerState::GetInstallerDirectory( | 
|  | 601     const Version& version) const { | 
| 601   return target_path().Append(ASCIIToWide(version.GetString())) | 602   return target_path().Append(ASCIIToWide(version.GetString())) | 
| 602       .Append(kInstallerDir); | 603       .Append(kInstallerDir); | 
| 603 } | 604 } | 
| 604 | 605 | 
| 605 // static | 606 // static | 
| 606 bool InstallerState::IsFileInUse(const base::FilePath& file) { | 607 bool InstallerState::IsFileInUse(const base::FilePath& file) { | 
| 607   // Call CreateFile with a share mode of 0 which should cause this to fail | 608   // Call CreateFile with a share mode of 0 which should cause this to fail | 
| 608   // with ERROR_SHARING_VIOLATION if the file exists and is in-use. | 609   // with ERROR_SHARING_VIOLATION if the file exists and is in-use. | 
| 609   return !base::win::ScopedHandle(CreateFile(file.value().c_str(), | 610   return !base::win::ScopedHandle(CreateFile(file.value().c_str(), | 
| 610                                              GENERIC_WRITE, 0, NULL, | 611                                              GENERIC_WRITE, 0, NULL, | 
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 791   } | 792   } | 
| 792   if (!install_list->Do()) | 793   if (!install_list->Do()) | 
| 793     LOG(ERROR) << "Failed to record installer error information in registry."; | 794     LOG(ERROR) << "Failed to record installer error information in registry."; | 
| 794 } | 795 } | 
| 795 | 796 | 
| 796 bool InstallerState::RequiresActiveSetup() const { | 797 bool InstallerState::RequiresActiveSetup() const { | 
| 797   return system_install() && FindProduct(BrowserDistribution::CHROME_BROWSER); | 798   return system_install() && FindProduct(BrowserDistribution::CHROME_BROWSER); | 
| 798 } | 799 } | 
| 799 | 800 | 
| 800 }  // namespace installer | 801 }  // namespace installer | 
| OLD | NEW | 
|---|