| Index: chrome/installer/util/installation_state.h
|
| ===================================================================
|
| --- chrome/installer/util/installation_state.h (revision 71802)
|
| +++ chrome/installer/util/installation_state.h (working copy)
|
| @@ -9,6 +9,8 @@
|
| #include <string>
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/command_line.h"
|
| +#include "base/file_path.h"
|
| #include "base/scoped_ptr.h"
|
| #include "chrome/installer/util/browser_distribution.h"
|
| #include "chrome/installer/util/channel_info.h"
|
| @@ -19,29 +21,60 @@
|
|
|
| class InstallationState;
|
| class MasterPreferences;
|
| -class PackageProperties;
|
|
|
| +// A representation of a product's state on the machine based on the contents
|
| +// of the Windows registry.
|
| class ProductState {
|
| public:
|
| ProductState();
|
| - void Initialize(bool system_install,
|
| - const std::wstring& version_key,
|
| - const std::wstring& state_key);
|
| + // Returns true if the product is installed (i.e., the product's Clients key
|
| + // exists and has a "pv" value); false otherwise.
|
| + bool Initialize(bool system_install,
|
| + BrowserDistribution::Type type);
|
| + bool Initialize(bool system_install,
|
| + BrowserDistribution* distribution);
|
|
|
| const ChannelInfo& channel() const { return channel_; }
|
| ChannelInfo& channel() { return channel_; }
|
|
|
| + FilePath GetSetupPath() const;
|
| +
|
| const Version& version() const;
|
| // Takes ownership of |version|.
|
| void set_version(Version* version) { version_.reset(version); }
|
|
|
| - void CopyFrom(const ProductState& other);
|
| + // May be NULL. Ownership of a returned value is not passed to the caller.
|
| + const Version* old_version() const { return old_version_.get(); }
|
| + // Takes ownership of |version|.
|
| + void set_old_version(Version* version) { old_version_.reset(version); }
|
|
|
| + const std::wstring& rename_cmd() const { return rename_cmd_; }
|
| + void set_rename_cmd(const std::wstring& rename_cmd) {
|
| + rename_cmd_ = rename_cmd;
|
| + }
|
| +
|
| + // True if the "msi" value in the ClientState key is present and non-zero.
|
| + bool msi() const { return msi_; }
|
| + void set_msi(bool set) { msi_ = set; }
|
| +
|
| + const CommandLine& uninstall_command() const { return uninstall_command_; }
|
| +
|
| + // True if |uninstall_command| contains --multi-install.
|
| + bool multi_install() const { return multi_install_; }
|
| +
|
| + // Returns |this| instance a la operator=().
|
| + ProductState& CopyFrom(const ProductState& other);
|
| +
|
| private:
|
| friend class InstallationState;
|
|
|
| ChannelInfo channel_;
|
| scoped_ptr<Version> version_;
|
| + scoped_ptr<Version> old_version_;
|
| + std::wstring rename_cmd_;
|
| + CommandLine uninstall_command_;
|
| + bool msi_;
|
| + bool multi_install_;
|
| DISALLOW_COPY_AND_ASSIGN(ProductState);
|
| }; // class ProductState
|
|
|
| @@ -51,13 +84,8 @@
|
| InstallationState();
|
|
|
| // Initializes |this| with the machine's current state.
|
| - void Initialize(const MasterPreferences& prefs);
|
| + void Initialize();
|
|
|
| - // Returns the state of the multi-installer package or NULL if no
|
| - // multi-install products are installed.
|
| - // Caller does NOT assume ownership of returned pointer.
|
| - const ProductState* GetMultiPackageState(bool system_install) const;
|
| -
|
| // Returns the state of a product or NULL if not installed.
|
| // Caller does NOT assume ownership of returned pointer.
|
| const ProductState* GetProductState(bool system_install,
|
| @@ -67,17 +95,11 @@
|
| enum {
|
| CHROME_BROWSER_INDEX,
|
| CHROME_FRAME_INDEX,
|
| - MULTI_PACKAGE_INDEX,
|
| + CHROME_BINARIES_INDEX,
|
| NUM_PRODUCTS
|
| };
|
|
|
| static int IndexFromDistType(BrowserDistribution::Type type);
|
| - static void InitializeProduct(bool system_install,
|
| - BrowserDistribution* distribution,
|
| - ProductState* product);
|
| - static void InitializeMultiPackage(bool system_install,
|
| - PackageProperties& properties,
|
| - ProductState* product);
|
|
|
| ProductState user_products_[NUM_PRODUCTS];
|
| ProductState system_products_[NUM_PRODUCTS];
|
|
|