| 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 #ifndef CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ |
| 6 #define CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ | 6 #define CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
| 17 #include "base/version.h" | 17 #include "base/version.h" |
| 18 #include "chrome/installer/util/browser_distribution.h" | 18 #include "chrome/installer/util/browser_distribution.h" |
| 19 #include "chrome/installer/util/product.h" | 19 #include "chrome/installer/util/product.h" |
| 20 #include "chrome/installer/util/util_constants.h" | 20 #include "chrome/installer/util/util_constants.h" |
| 21 | 21 |
| 22 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 23 #include <windows.h> // NOLINT | 23 #include <windows.h> // NOLINT |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 class CommandLine; | 26 class CommandLine; |
| 27 class Version; | |
| 28 | 27 |
| 29 namespace installer { | 28 namespace installer { |
| 30 | 29 |
| 31 class ChannelInfo; | 30 class ChannelInfo; |
| 32 class InstallationState; | 31 class InstallationState; |
| 33 class MasterPreferences; | 32 class MasterPreferences; |
| 34 | 33 |
| 35 class ProductState; | 34 class ProductState; |
| 36 | 35 |
| 37 typedef std::vector<Product*> Products; | 36 typedef std::vector<Product*> Products; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 return multi_package_distribution_; | 147 return multi_package_distribution_; |
| 149 } | 148 } |
| 150 | 149 |
| 151 const Products& products() const { return products_.get(); } | 150 const Products& products() const { return products_.get(); } |
| 152 | 151 |
| 153 // Returns the product of the desired type, or NULL if none found. | 152 // Returns the product of the desired type, or NULL if none found. |
| 154 const Product* FindProduct(BrowserDistribution::Type distribution_type) const; | 153 const Product* FindProduct(BrowserDistribution::Type distribution_type) const; |
| 155 | 154 |
| 156 // Returns the currently installed version in |target_path|, or NULL if no | 155 // Returns the currently installed version in |target_path|, or NULL if no |
| 157 // products are installed. Ownership is passed to the caller. | 156 // products are installed. Ownership is passed to the caller. |
| 158 Version* GetCurrentVersion(const InstallationState& machine_state) const; | 157 base::Version* GetCurrentVersion( |
| 158 const InstallationState& machine_state) const; |
| 159 | 159 |
| 160 // Returns the critical update version if all of the following are true: | 160 // Returns the critical update version if all of the following are true: |
| 161 // * --critical-update-version=CUV was specified on the command-line. | 161 // * --critical-update-version=CUV was specified on the command-line. |
| 162 // * current_version == NULL or current_version < CUV. | 162 // * current_version == NULL or current_version < CUV. |
| 163 // * new_version >= CUV. | 163 // * new_version >= CUV. |
| 164 // Otherwise, returns an invalid version. | 164 // Otherwise, returns an invalid version. |
| 165 Version DetermineCriticalVersion(const Version* current_version, | 165 base::Version DetermineCriticalVersion( |
| 166 const Version& new_version) const; | 166 const base::Version* current_version, |
| 167 const base::Version& new_version) const; |
| 167 | 168 |
| 168 // Returns whether or not there is currently a Chrome Frame instance running. | 169 // Returns whether or not there is currently a Chrome Frame instance running. |
| 169 // Note that there isn't a mechanism to lock Chrome Frame in place, so Chrome | 170 // Note that there isn't a mechanism to lock Chrome Frame in place, so Chrome |
| 170 // Frame may either exit or start up after this is called. | 171 // Frame may either exit or start up after this is called. |
| 171 bool IsChromeFrameRunning(const InstallationState& machine_state) const; | 172 bool IsChromeFrameRunning(const InstallationState& machine_state) const; |
| 172 | 173 |
| 173 // Returns the path to the installer under Chrome version folder | 174 // Returns the path to the installer under Chrome version folder |
| 174 // (for example <target_path>\Google\Chrome\Application\<Version>\Installer) | 175 // (for example <target_path>\Google\Chrome\Application\<Version>\Installer) |
| 175 base::FilePath GetInstallerDirectory(const Version& version) const; | 176 base::FilePath GetInstallerDirectory(const base::Version& version) const; |
| 176 | 177 |
| 177 // Try to delete all directories under |temp_path| whose versions are less | 178 // Try to delete all directories under |temp_path| whose versions are less |
| 178 // than |new_version| and not equal to |existing_version|. |existing_version| | 179 // than |new_version| and not equal to |existing_version|. |existing_version| |
| 179 // may be NULL. | 180 // may be NULL. |
| 180 void RemoveOldVersionDirectories(const Version& new_version, | 181 void RemoveOldVersionDirectories(const base::Version& new_version, |
| 181 Version* existing_version, | 182 base::Version* existing_version, |
| 182 const base::FilePath& temp_path) const; | 183 const base::FilePath& temp_path) const; |
| 183 | 184 |
| 184 // Adds to |com_dll_list| the list of COM DLLs that are to be registered | 185 // Adds to |com_dll_list| the list of COM DLLs that are to be registered |
| 185 // and/or unregistered. The list may be empty. | 186 // and/or unregistered. The list may be empty. |
| 186 void AddComDllList(std::vector<base::FilePath>* com_dll_list) const; | 187 void AddComDllList(std::vector<base::FilePath>* com_dll_list) const; |
| 187 | 188 |
| 188 bool SetChannelFlags(bool set, ChannelInfo* channel_info) const; | 189 bool SetChannelFlags(bool set, ChannelInfo* channel_info) const; |
| 189 | 190 |
| 190 // See InstallUtil::UpdateInstallerStage. | 191 // See InstallUtil::UpdateInstallerStage. |
| 191 void UpdateStage(installer::InstallerStage stage) const; | 192 void UpdateStage(installer::InstallerStage stage) const; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // Sets this object's package type and updates the multi_package_distribution_ | 237 // Sets this object's package type and updates the multi_package_distribution_ |
| 237 // accordingly. | 238 // accordingly. |
| 238 void set_package_type(PackageType type); | 239 void set_package_type(PackageType type); |
| 239 | 240 |
| 240 Operation operation_; | 241 Operation operation_; |
| 241 base::FilePath target_path_; | 242 base::FilePath target_path_; |
| 242 std::wstring state_key_; | 243 std::wstring state_key_; |
| 243 BrowserDistribution::Type state_type_; | 244 BrowserDistribution::Type state_type_; |
| 244 ScopedVector<Product> products_; | 245 ScopedVector<Product> products_; |
| 245 BrowserDistribution* multi_package_distribution_; | 246 BrowserDistribution* multi_package_distribution_; |
| 246 Version critical_update_version_; | 247 base::Version critical_update_version_; |
| 247 Level level_; | 248 Level level_; |
| 248 PackageType package_type_; | 249 PackageType package_type_; |
| 249 #if defined(OS_WIN) | 250 #if defined(OS_WIN) |
| 250 HKEY root_key_; | 251 HKEY root_key_; |
| 251 #endif | 252 #endif |
| 252 bool msi_; | 253 bool msi_; |
| 253 bool verbose_logging_; | 254 bool verbose_logging_; |
| 254 bool ensure_google_update_present_; | 255 bool ensure_google_update_present_; |
| 255 | 256 |
| 256 private: | 257 private: |
| 257 DISALLOW_COPY_AND_ASSIGN(InstallerState); | 258 DISALLOW_COPY_AND_ASSIGN(InstallerState); |
| 258 }; // class InstallerState | 259 }; // class InstallerState |
| 259 | 260 |
| 260 } // namespace installer | 261 } // namespace installer |
| 261 | 262 |
| 262 #endif // CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ | 263 #endif // CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ |
| OLD | NEW |