| Index: chrome/installer/setup/installer_state.h
|
| diff --git a/chrome/installer/setup/installer_state.h b/chrome/installer/setup/installer_state.h
|
| index 2c25f3c1c0de7ff27c831cc4e71d26d96f32fc02..05cfe697612b79512fdf1ade8faa06bc915d61b3 100644
|
| --- a/chrome/installer/setup/installer_state.h
|
| +++ b/chrome/installer/setup/installer_state.h
|
| @@ -5,15 +5,11 @@
|
| #ifndef CHROME_INSTALLER_SETUP_INSTALLER_STATE_H_
|
| #define CHROME_INSTALLER_SETUP_INSTALLER_STATE_H_
|
|
|
| -#include <stdint.h>
|
| -
|
| #include <memory>
|
| -#include <vector>
|
|
|
| #include "base/files/file_path.h"
|
| #include "base/logging.h"
|
| #include "base/macros.h"
|
| -#include "base/memory/scoped_vector.h"
|
| #include "base/strings/string16.h"
|
| #include "base/version.h"
|
| #include "build/build_config.h"
|
| @@ -37,17 +33,9 @@ class MasterPreferences;
|
|
|
| class ProductState;
|
|
|
| -typedef std::vector<Product*> Products;
|
| -
|
| -// Encapsulates the state of the current installation operation. Only valid
|
| -// for installs and upgrades (not for uninstalls or non-install commands).
|
| -// This class interprets the command-line arguments and master preferences and
|
| -// determines the operations to be performed. For example, the Chrome Binaries
|
| -// are automatically added if required in multi-install mode.
|
| -// TODO(erikwright): This is now used a fair bit during uninstall, and
|
| -// InstallerState::Initialize() contains a lot of code for uninstall. The class
|
| -// comment should probably be updated.
|
| -// TODO(grt): Rename to InstallerEngine/Conductor or somesuch?
|
| +// Encapsulates the state of the current installation operation. This class
|
| +// interprets the command-line arguments and master preferences and determines
|
| +// the operations to be performed.
|
| class InstallerState {
|
| public:
|
| enum Level {
|
| @@ -56,17 +44,9 @@ class InstallerState {
|
| SYSTEM_LEVEL
|
| };
|
|
|
| - enum PackageType {
|
| - UNKNOWN_PACKAGE_TYPE,
|
| - SINGLE_PACKAGE,
|
| - MULTI_PACKAGE
|
| - };
|
| -
|
| enum Operation {
|
| UNINITIALIZED,
|
| SINGLE_INSTALL_OR_UPDATE,
|
| - MULTI_INSTALL,
|
| - MULTI_UPDATE,
|
| UNINSTALL
|
| };
|
|
|
| @@ -84,37 +64,25 @@ class InstallerState {
|
| const InstallationState& machine_state);
|
|
|
| // Adds a product constructed on the basis of |state|, setting this object's
|
| - // msi flag if |state| is msi-installed. Returns the product that was added,
|
| - // or NULL if |state| is incompatible with this object. Ownership is not
|
| + // msi flag if |state| is msi-installed. Returns the product that was added,
|
| + // or NULL if |state| is incompatible with this object. Ownership is not
|
| // passed to the caller.
|
| Product* AddProductFromState(BrowserDistribution::Type type,
|
| const ProductState& state);
|
|
|
| // Returns the product that was added, or NULL if |product| is incompatible
|
| - // with this object. Ownership of |product| is taken by this object, while
|
| - // ownership of the return value is not passed to the caller.
|
| - Product* AddProduct(std::unique_ptr<Product>* product);
|
| -
|
| - // Removes |product| from the set of products to be operated on. The object
|
| - // pointed to by |product| is freed. Returns false if |product| is not
|
| - // present in the set.
|
| - bool RemoveProduct(const Product* product);
|
| + // with this object. Ownership of the return value is not given to the caller.
|
| + Product* AddProduct(std::unique_ptr<Product> product);
|
|
|
| // The level (user or system) of this operation.
|
| Level level() const { return level_; }
|
|
|
| - // The package type (single or multi) of this operation.
|
| - PackageType package_type() const { return package_type_; }
|
| -
|
| // An identifier of this operation.
|
| Operation operation() const { return operation_; }
|
|
|
| // A convenience method returning level() == SYSTEM_LEVEL.
|
| bool system_install() const;
|
|
|
| - // A convenience method returning package_type() == MULTI_PACKAGE.
|
| - bool is_multi_install() const;
|
| -
|
| // The full path to the place where the operand resides.
|
| const base::FilePath& target_path() const { return target_path_; }
|
|
|
| @@ -152,21 +120,13 @@ class InstallerState {
|
| // single-install.
|
| bool is_migrating_to_single() const { return is_migrating_to_single_; }
|
|
|
| - // Returns the BrowserDistribution instance corresponding to the binaries for
|
| - // this run if we're operating on a multi-package product.
|
| - BrowserDistribution* multi_package_binaries_distribution() const {
|
| - DCHECK(package_type_ == MULTI_PACKAGE);
|
| - DCHECK(multi_package_distribution_ != NULL);
|
| - return multi_package_distribution_;
|
| + const Product& product() const {
|
| + DCHECK(product_);
|
| + return *product_;
|
| }
|
|
|
| - const Products& products() const { return products_.get(); }
|
| -
|
| - // Returns the product of the desired type, or NULL if none found.
|
| - const Product* FindProduct(BrowserDistribution::Type distribution_type) const;
|
| -
|
| // Returns the currently installed version in |target_path|, or NULL if no
|
| - // products are installed. Ownership is passed to the caller.
|
| + // products are installed. Ownership is passed to the caller.
|
| base::Version* GetCurrentVersion(
|
| const InstallationState& machine_state) const;
|
|
|
| @@ -179,38 +139,24 @@ class InstallerState {
|
| const base::Version* current_version,
|
| const base::Version& new_version) 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 true if any of the binaries from a multi-install Chrome Frame that
|
| - // has been migrated to single-install are still in use.
|
| - bool AreBinariesInUse(const InstallationState& machine_state) const;
|
| -
|
| // Returns the path to the installer under Chrome version folder
|
| // (for example <target_path>\Google\Chrome\Application\<Version>\Installer)
|
| base::FilePath GetInstallerDirectory(const base::Version& version) const;
|
|
|
| - // Adds to |com_dll_list| the list of COM DLLs that are to be registered
|
| - // and/or unregistered. The list may be empty.
|
| - void AddComDllList(std::vector<base::FilePath>* com_dll_list) const;
|
| -
|
| // Sets the current stage of processing. This reports a progress value to
|
| // Google Update for presentation to a user.
|
| void SetStage(InstallerStage stage) const;
|
|
|
| - // For a MULTI_INSTALL or MULTI_UPDATE operation, updates the Google Update
|
| - // "ap" values for all products being operated on.
|
| + // Strips all evidence of multi-install from Chrome's "ap" value.
|
| void UpdateChannels() const;
|
|
|
| // Sets installer result information in the registry for consumption by Google
|
| - // Update. The InstallerResult value is set to 0 (SUCCESS) or 1
|
| + // Update. The InstallerResult value is set to 0 (SUCCESS) or 1
|
| // (FAILED_CUSTOM_ERROR) depending on whether |status| maps to success or not.
|
| // |status| itself is written to the InstallerError value.
|
| // |string_resource_id|, if non-zero, identifies a localized string written to
|
| - // the InstallerResultUIString value. |launch_cmd|, if non-NULL and
|
| - // non-empty, is written to the InstallerSuccessLaunchCmdLine value.
|
| + // the InstallerResultUIString value. |launch_cmd|, if non-NULL and non-empty,
|
| + // is written to the InstallerSuccessLaunchCmdLine value.
|
| void WriteInstallerResult(InstallStatus status,
|
| int string_resource_id,
|
| const base::string16* launch_cmd) const;
|
| @@ -219,55 +165,28 @@ class InstallerState {
|
| bool RequiresActiveSetup() const;
|
|
|
| protected:
|
| - // Bits for the |file_bits| argument of AnyExistsAndIsInUse.
|
| - enum {
|
| - CHROME_DLL = 1 << 0,
|
| - CHROME_FRAME_DLL = 1 << 1,
|
| - CHROME_FRAME_HELPER_DLL = 1 << 2,
|
| - CHROME_FRAME_HELPER_EXE = 1 << 3,
|
| - NUM_BINARIES = 4
|
| - };
|
| -
|
| - // Returns true if |file| exists and cannot be opened for exclusive write
|
| - // access.
|
| - static bool IsFileInUse(const base::FilePath& file);
|
| -
|
| // Clears the instance to an uninitialized state.
|
| void Clear();
|
|
|
| - // Returns true if any file corresponding to a bit in |file_bits| (from the
|
| - // enum above) for the currently installed version exists and is in use.
|
| - bool AnyExistsAndIsInUse(const InstallationState& machine_state,
|
| - uint32_t file_bits) const;
|
| - base::FilePath GetDefaultProductInstallPath(BrowserDistribution* dist) const;
|
| - bool CanAddProduct(const Product& product,
|
| - const base::FilePath* product_dir) const;
|
| + bool CanAddProduct(const base::FilePath* product_dir) const;
|
| Product* AddProductInDirectory(const base::FilePath* product_dir,
|
| - std::unique_ptr<Product>* product);
|
| + std::unique_ptr<Product> product);
|
| Product* AddProductFromPreferences(
|
| BrowserDistribution::Type distribution_type,
|
| const MasterPreferences& prefs,
|
| const InstallationState& machine_state);
|
| - bool IsMultiInstallUpdate(const MasterPreferences& prefs,
|
| - const InstallationState& machine_state);
|
|
|
| // Sets this object's level and updates the root_key_ accordingly.
|
| void set_level(Level level);
|
|
|
| - // Sets this object's package type and updates the multi_package_distribution_
|
| - // accordingly.
|
| - void set_package_type(PackageType type);
|
| -
|
| Operation operation_;
|
| base::FilePath target_path_;
|
| base::string16 state_key_;
|
| BrowserDistribution::Type state_type_;
|
| - ScopedVector<Product> products_;
|
| - BrowserDistribution* multi_package_distribution_;
|
| + std::unique_ptr<Product> product_;
|
| base::Version critical_update_version_;
|
| ProgressCalculator progress_calculator_;
|
| Level level_;
|
| - PackageType package_type_;
|
| #if defined(OS_WIN)
|
| HKEY root_key_;
|
| #endif
|
|
|