| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_INSTALLATION_STATE_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_INSTALLATION_STATE_H_ |
| 6 #define CHROME_INSTALLER_UTIL_INSTALLATION_STATE_H_ | 6 #define CHROME_INSTALLER_UTIL_INSTALLATION_STATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // Encapsulates the state of all products on the system. | 48 // Encapsulates the state of all products on the system. |
| 49 class InstallationState { | 49 class InstallationState { |
| 50 public: | 50 public: |
| 51 InstallationState(); | 51 InstallationState(); |
| 52 | 52 |
| 53 // Initializes |this| with the machine's current state. | 53 // Initializes |this| with the machine's current state. |
| 54 void Initialize(const MasterPreferences& prefs); | 54 void Initialize(const MasterPreferences& prefs); |
| 55 | 55 |
| 56 // Returns the state of the multi-installer package or NULL if no | 56 // Returns the state of the multi-installer package or NULL if no |
| 57 // multi-install products are installed. | 57 // multi-install products are installed. |
| 58 // Caller does NOT assume ownership of returned pointer. |
| 58 const ProductState* GetMultiPackageState(bool system_install) const; | 59 const ProductState* GetMultiPackageState(bool system_install) const; |
| 59 | 60 |
| 60 // Sets the state of the multi-installer package; intended for tests. | |
| 61 void SetMultiPackageState(bool system_install, | |
| 62 const ProductState& package_state); | |
| 63 | |
| 64 // Returns the state of a product or NULL if not installed. | 61 // Returns the state of a product or NULL if not installed. |
| 62 // Caller does NOT assume ownership of returned pointer. |
| 65 const ProductState* GetProductState(bool system_install, | 63 const ProductState* GetProductState(bool system_install, |
| 66 BrowserDistribution::Type type) const; | 64 BrowserDistribution::Type type) const; |
| 67 | 65 |
| 68 // Sets the state of a product; indended for tests. | 66 protected: |
| 69 void SetProductState(bool system_install, | |
| 70 BrowserDistribution::Type type, | |
| 71 const ProductState& product_state); | |
| 72 | |
| 73 private: | |
| 74 enum { | 67 enum { |
| 75 CHROME_BROWSER_INDEX, | 68 CHROME_BROWSER_INDEX, |
| 76 CHROME_FRAME_INDEX, | 69 CHROME_FRAME_INDEX, |
| 77 MULTI_PACKAGE_INDEX, | 70 MULTI_PACKAGE_INDEX, |
| 78 NUM_PRODUCTS | 71 NUM_PRODUCTS |
| 79 }; | 72 }; |
| 80 | 73 |
| 81 static int IndexFromDistType(BrowserDistribution::Type type); | 74 static int IndexFromDistType(BrowserDistribution::Type type); |
| 82 static void InitializeProduct(bool system_install, | 75 static void InitializeProduct(bool system_install, |
| 83 BrowserDistribution* distribution, | 76 BrowserDistribution* distribution, |
| 84 ProductState* product); | 77 ProductState* product); |
| 85 static void InitializeMultiPackage(bool system_install, | 78 static void InitializeMultiPackage(bool system_install, |
| 86 PackageProperties& properties, | 79 PackageProperties& properties, |
| 87 ProductState* product); | 80 ProductState* product); |
| 88 | 81 |
| 89 ProductState user_products_[NUM_PRODUCTS]; | 82 ProductState user_products_[NUM_PRODUCTS]; |
| 90 ProductState system_products_[NUM_PRODUCTS]; | 83 ProductState system_products_[NUM_PRODUCTS]; |
| 91 | 84 |
| 85 private: |
| 92 DISALLOW_COPY_AND_ASSIGN(InstallationState); | 86 DISALLOW_COPY_AND_ASSIGN(InstallationState); |
| 93 }; // class InstallationState | 87 }; // class InstallationState |
| 94 | 88 |
| 95 } // namespace installer | 89 } // namespace installer |
| 96 | 90 |
| 97 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_STATE_H_ | 91 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_STATE_H_ |
| OLD | NEW |