diff options
author | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-11 12:37:27 +0000 |
---|---|---|
committer | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-11 12:37:27 +0000 |
commit | 9dccb391ba400cdf75f7fd0bec7d6bfbc40c2785 (patch) | |
tree | 253aaa12cd406c486b0ea47efac2face930dfb61 /chrome/installer/util | |
parent | 49c85aaf4016f37ae254ac96ff468ee701b7ba2e (diff) | |
download | chromium_src-9dccb391ba400cdf75f7fd0bec7d6bfbc40c2785.zip chromium_src-9dccb391ba400cdf75f7fd0bec7d6bfbc40c2785.tar.gz chromium_src-9dccb391ba400cdf75f7fd0bec7d6bfbc40c2785.tar.bz2 |
Fix DCHECK in GCF quick-enable.
Make the determination of whether or not Chrome Frame is in use on-demand rather than during initialization.
BUG=92146
TEST=GCF quick-enable should work again.
Review URL: http://codereview.chromium.org/7600021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96370 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util')
-rw-r--r-- | chrome/installer/util/installer_state.cc | 40 | ||||
-rw-r--r-- | chrome/installer/util/installer_state.h | 12 |
2 files changed, 23 insertions, 29 deletions
diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc index b0a3dae..ba0740d 100644 --- a/chrome/installer/util/installer_state.cc +++ b/chrome/installer/util/installer_state.cc @@ -76,8 +76,7 @@ InstallerState::InstallerState() state_type_(BrowserDistribution::CHROME_BROWSER), root_key_(NULL), msi_(false), - verbose_logging_(false), - is_chrome_frame_running_(false) { + verbose_logging_(false) { } InstallerState::InstallerState(Level level) @@ -88,8 +87,7 @@ InstallerState::InstallerState(Level level) state_type_(BrowserDistribution::CHROME_BROWSER), root_key_(NULL), msi_(false), - verbose_logging_(false), - is_chrome_frame_running_(false) { + verbose_logging_(false) { // Use set_level() so that root_key_ is updated properly. set_level(level); } @@ -158,8 +156,6 @@ void InstallerState::Initialize(const CommandLine& command_line, state_key_ = operand->GetStateKey(); state_type_ = operand->GetType(); - - is_chrome_frame_running_ = DetectChromeFrameInUse(machine_state); } void InstallerState::set_level(Level level) { @@ -417,22 +413,8 @@ Version* InstallerState::GetCurrentVersion( return current_version.release(); } -FilePath InstallerState::GetInstallerDirectory(const Version& version) const { - return target_path().Append(ASCIIToWide(version.GetString())) - .Append(kInstallerDir); -} - -// static -bool InstallerState::IsFileInUse(const FilePath& file) { - // Call CreateFile with a share mode of 0 which should cause this to fail - // with ERROR_SHARING_VIOLATION if the file exists and is in-use. - return !base::win::ScopedHandle(CreateFile(file.value().c_str(), - GENERIC_WRITE, 0, NULL, - OPEN_EXISTING, 0, 0)).IsValid(); -} - -bool InstallerState::DetectChromeFrameInUse( - const InstallationState& machine_state) { +bool InstallerState::IsChromeFrameRunning( + const InstallationState& machine_state) const { // We check only for the current version (e.g. the version we are upgrading // _from_). We don't need to check interstitial versions if any (as would // occur in the case of multiple updates) since if they are in use, we are @@ -448,6 +430,20 @@ bool InstallerState::DetectChromeFrameInUse( return in_use; } +FilePath InstallerState::GetInstallerDirectory(const Version& version) const { + return target_path().Append(ASCIIToWide(version.GetString())) + .Append(kInstallerDir); +} + +// static +bool InstallerState::IsFileInUse(const FilePath& file) { + // Call CreateFile with a share mode of 0 which should cause this to fail + // with ERROR_SHARING_VIOLATION if the file exists and is in-use. + return !base::win::ScopedHandle(CreateFile(file.value().c_str(), + GENERIC_WRITE, 0, NULL, + OPEN_EXISTING, 0, 0)).IsValid(); +} + void InstallerState::RemoveOldVersionDirectories( const Version& new_version, Version* existing_version, diff --git a/chrome/installer/util/installer_state.h b/chrome/installer/util/installer_state.h index 565766e..04417be 100644 --- a/chrome/installer/util/installer_state.h +++ b/chrome/installer/util/installer_state.h @@ -105,11 +105,6 @@ class InstallerState { // TODO(grt): Eradicate the bool in favor of the enum. bool is_multi_install() const; - // Returns whether or not there is currently a Chrome Frame instance running. - // Note that there isn't a mechanism to lock Chrome Frame in place, so Chrome - // Frame may either exit or start up after this is called. - bool is_chrome_frame_running() const { return is_chrome_frame_running_; } - // The full path to the place where the operand resides. const FilePath& target_path() const { return target_path_; } @@ -149,6 +144,11 @@ class InstallerState { // products are installed. Ownership is passed to the caller. Version* GetCurrentVersion(const InstallationState& machine_state) const; + // Returns whether or not there is currently a Chrome Frame instance running. + // Note that there isn't a mechanism to lock Chrome Frame in place, so Chrome + // Frame may either exit or start up after this is called. + bool IsChromeFrameRunning(const InstallationState& machine_state) const; + // Returns the path to the installer under Chrome version folder // (for example <target_path>\Google\Chrome\Application\<Version>\Installer) FilePath GetInstallerDirectory(const Version& version) const; @@ -197,7 +197,6 @@ class InstallerState { const InstallationState& machine_state); bool IsMultiInstallUpdate(const MasterPreferences& prefs, const InstallationState& machine_state); - bool DetectChromeFrameInUse(const InstallationState& machine_state); // Sets this object's level and updates the root_key_ accordingly. void set_level(Level level); @@ -219,7 +218,6 @@ class InstallerState { #endif bool msi_; bool verbose_logging_; - bool is_chrome_frame_running_; private: DISALLOW_COPY_AND_ASSIGN(InstallerState); |