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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <set> |
10 #include <string> | 11 #include <string> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
18 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
19 #include "base/version.h" | 20 #include "base/version.h" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 bool IsChromeFrameRunning(const InstallationState& machine_state) const; | 171 bool IsChromeFrameRunning(const InstallationState& machine_state) const; |
171 | 172 |
172 // Returns true if any of the binaries from a multi-install Chrome Frame that | 173 // Returns true if any of the binaries from a multi-install Chrome Frame that |
173 // has been migrated to single-install are still in use. | 174 // has been migrated to single-install are still in use. |
174 bool AreBinariesInUse(const InstallationState& machine_state) const; | 175 bool AreBinariesInUse(const InstallationState& machine_state) const; |
175 | 176 |
176 // Returns the path to the installer under Chrome version folder | 177 // Returns the path to the installer under Chrome version folder |
177 // (for example <target_path>\Google\Chrome\Application\<Version>\Installer) | 178 // (for example <target_path>\Google\Chrome\Application\<Version>\Installer) |
178 base::FilePath GetInstallerDirectory(const base::Version& version) const; | 179 base::FilePath GetInstallerDirectory(const base::Version& version) const; |
179 | 180 |
| 181 // Try to delete all directories under |temp_path| whose versions are less |
| 182 // than |new_version| and not equal to |existing_version|. |existing_version| |
| 183 // may be NULL. |
| 184 void RemoveOldVersionDirectories(const base::Version& new_version, |
| 185 base::Version* existing_version, |
| 186 const base::FilePath& temp_path) const; |
| 187 |
180 // Adds to |com_dll_list| the list of COM DLLs that are to be registered | 188 // Adds to |com_dll_list| the list of COM DLLs that are to be registered |
181 // and/or unregistered. The list may be empty. | 189 // and/or unregistered. The list may be empty. |
182 void AddComDllList(std::vector<base::FilePath>* com_dll_list) const; | 190 void AddComDllList(std::vector<base::FilePath>* com_dll_list) const; |
183 | 191 |
184 // See InstallUtil::UpdateInstallerStage. | 192 // See InstallUtil::UpdateInstallerStage. |
185 void UpdateStage(installer::InstallerStage stage) const; | 193 void UpdateStage(installer::InstallerStage stage) const; |
186 | 194 |
187 // For a MULTI_INSTALL or MULTI_UPDATE operation, updates the Google Update | 195 // For a MULTI_INSTALL or MULTI_UPDATE operation, updates the Google Update |
188 // "ap" values for all products being operated on. | 196 // "ap" values for all products being operated on. |
189 void UpdateChannels() const; | 197 void UpdateChannels() const; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 const base::FilePath* product_dir) const; | 236 const base::FilePath* product_dir) const; |
229 Product* AddProductInDirectory(const base::FilePath* product_dir, | 237 Product* AddProductInDirectory(const base::FilePath* product_dir, |
230 scoped_ptr<Product>* product); | 238 scoped_ptr<Product>* product); |
231 Product* AddProductFromPreferences( | 239 Product* AddProductFromPreferences( |
232 BrowserDistribution::Type distribution_type, | 240 BrowserDistribution::Type distribution_type, |
233 const MasterPreferences& prefs, | 241 const MasterPreferences& prefs, |
234 const InstallationState& machine_state); | 242 const InstallationState& machine_state); |
235 bool IsMultiInstallUpdate(const MasterPreferences& prefs, | 243 bool IsMultiInstallUpdate(const MasterPreferences& prefs, |
236 const InstallationState& machine_state); | 244 const InstallationState& machine_state); |
237 | 245 |
| 246 // Enumerates all files named one of |
| 247 // [chrome.exe, old_chrome.exe, new_chrome.exe] in target_path_ and |
| 248 // returns their version numbers in a set. |
| 249 void GetExistingExeVersions(std::set<std::string>* existing_versions) const; |
| 250 |
238 // Sets this object's level and updates the root_key_ accordingly. | 251 // Sets this object's level and updates the root_key_ accordingly. |
239 void set_level(Level level); | 252 void set_level(Level level); |
240 | 253 |
241 // Sets this object's package type and updates the multi_package_distribution_ | 254 // Sets this object's package type and updates the multi_package_distribution_ |
242 // accordingly. | 255 // accordingly. |
243 void set_package_type(PackageType type); | 256 void set_package_type(PackageType type); |
244 | 257 |
245 Operation operation_; | 258 Operation operation_; |
246 base::FilePath target_path_; | 259 base::FilePath target_path_; |
247 base::string16 state_key_; | 260 base::string16 state_key_; |
248 BrowserDistribution::Type state_type_; | 261 BrowserDistribution::Type state_type_; |
249 ScopedVector<Product> products_; | 262 ScopedVector<Product> products_; |
250 BrowserDistribution* multi_package_distribution_; | 263 BrowserDistribution* multi_package_distribution_; |
251 base::Version critical_update_version_; | 264 base::Version critical_update_version_; |
252 Level level_; | 265 Level level_; |
253 PackageType package_type_; | 266 PackageType package_type_; |
254 #if defined(OS_WIN) | 267 #if defined(OS_WIN) |
255 HKEY root_key_; | 268 HKEY root_key_; |
256 #endif | 269 #endif |
257 bool msi_; | 270 bool msi_; |
258 bool verbose_logging_; | 271 bool verbose_logging_; |
259 | 272 |
260 private: | 273 private: |
261 DISALLOW_COPY_AND_ASSIGN(InstallerState); | 274 DISALLOW_COPY_AND_ASSIGN(InstallerState); |
262 }; // class InstallerState | 275 }; // class InstallerState |
263 | 276 |
264 } // namespace installer | 277 } // namespace installer |
265 | 278 |
266 #endif // CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ | 279 #endif // CHROME_INSTALLER_UTIL_INSTALLER_STATE_H_ |
OLD | NEW |