| 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_INSTALLATION_VALIDATOR_H_ | 5 #ifndef CHROME_INSTALLER_UTIL_INSTALLATION_VALIDATOR_H_ |
| 6 #define CHROME_INSTALLER_UTIL_INSTALLATION_VALIDATOR_H_ | 6 #define CHROME_INSTALLER_UTIL_INSTALLATION_VALIDATOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 virtual void AddRenameSwitchExpectations( | 92 virtual void AddRenameSwitchExpectations( |
| 93 const ProductContext& ctx, | 93 const ProductContext& ctx, |
| 94 SwitchExpectations* expectations) const = 0; | 94 SwitchExpectations* expectations) const = 0; |
| 95 // Return true if the rules allow usagestats setting. | 95 // Return true if the rules allow usagestats setting. |
| 96 virtual bool UsageStatsAllowed(const ProductContext& ctx) const = 0; | 96 virtual bool UsageStatsAllowed(const ProductContext& ctx) const = 0; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 // Validation rules for the Chrome browser. | 99 // Validation rules for the Chrome browser. |
| 100 class ChromeRules : public ProductRules { | 100 class ChromeRules : public ProductRules { |
| 101 public: | 101 public: |
| 102 virtual BrowserDistribution::Type distribution_type() const override; | 102 BrowserDistribution::Type distribution_type() const override; |
| 103 virtual void AddUninstallSwitchExpectations( | 103 void AddUninstallSwitchExpectations( |
| 104 const ProductContext& ctx, | 104 const ProductContext& ctx, |
| 105 SwitchExpectations* expectations) const override; | 105 SwitchExpectations* expectations) const override; |
| 106 virtual void AddRenameSwitchExpectations( | 106 void AddRenameSwitchExpectations( |
| 107 const ProductContext& ctx, | 107 const ProductContext& ctx, |
| 108 SwitchExpectations* expectations) const override; | 108 SwitchExpectations* expectations) const override; |
| 109 virtual bool UsageStatsAllowed(const ProductContext& ctx) const override; | 109 bool UsageStatsAllowed(const ProductContext& ctx) const override; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 // Validation rules for Chrome Frame. | 112 // Validation rules for Chrome Frame. |
| 113 class ChromeFrameRules : public ProductRules { | 113 class ChromeFrameRules : public ProductRules { |
| 114 public: | 114 public: |
| 115 virtual BrowserDistribution::Type distribution_type() const override; | 115 BrowserDistribution::Type distribution_type() const override; |
| 116 virtual void AddUninstallSwitchExpectations( | 116 void AddUninstallSwitchExpectations( |
| 117 const ProductContext& ctx, | 117 const ProductContext& ctx, |
| 118 SwitchExpectations* expectations) const override; | 118 SwitchExpectations* expectations) const override; |
| 119 virtual void AddRenameSwitchExpectations( | 119 void AddRenameSwitchExpectations( |
| 120 const ProductContext& ctx, | 120 const ProductContext& ctx, |
| 121 SwitchExpectations* expectations) const override; | 121 SwitchExpectations* expectations) const override; |
| 122 virtual bool UsageStatsAllowed(const ProductContext& ctx) const override; | 122 bool UsageStatsAllowed(const ProductContext& ctx) const override; |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 // Validation rules for the multi-install Chrome binaries. | 125 // Validation rules for the multi-install Chrome binaries. |
| 126 class ChromeBinariesRules : public ProductRules { | 126 class ChromeBinariesRules : public ProductRules { |
| 127 public: | 127 public: |
| 128 virtual BrowserDistribution::Type distribution_type() const override; | 128 BrowserDistribution::Type distribution_type() const override; |
| 129 virtual void AddUninstallSwitchExpectations( | 129 void AddUninstallSwitchExpectations( |
| 130 const ProductContext& ctx, | 130 const ProductContext& ctx, |
| 131 SwitchExpectations* expectations) const override; | 131 SwitchExpectations* expectations) const override; |
| 132 virtual void AddRenameSwitchExpectations( | 132 void AddRenameSwitchExpectations( |
| 133 const ProductContext& ctx, | 133 const ProductContext& ctx, |
| 134 SwitchExpectations* expectations) const override; | 134 SwitchExpectations* expectations) const override; |
| 135 virtual bool UsageStatsAllowed(const ProductContext& ctx) const override; | 135 bool UsageStatsAllowed(const ProductContext& ctx) const override; |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 struct ProductContext { | 138 struct ProductContext { |
| 139 ProductContext(const InstallationState& machine_state_in, | 139 ProductContext(const InstallationState& machine_state_in, |
| 140 bool system_install_in, | 140 bool system_install_in, |
| 141 const ProductState& state_in, | 141 const ProductState& state_in, |
| 142 const ProductRules& rules_in) | 142 const ProductRules& rules_in) |
| 143 : machine_state(machine_state_in), | 143 : machine_state(machine_state_in), |
| 144 system_install(system_install_in), | 144 system_install(system_install_in), |
| 145 dist(BrowserDistribution::GetSpecificDistribution( | 145 dist(BrowserDistribution::GetSpecificDistribution( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // A collection of all valid installation types. | 207 // A collection of all valid installation types. |
| 208 static const InstallationType kInstallationTypes[]; | 208 static const InstallationType kInstallationTypes[]; |
| 209 | 209 |
| 210 private: | 210 private: |
| 211 DISALLOW_IMPLICIT_CONSTRUCTORS(InstallationValidator); | 211 DISALLOW_IMPLICIT_CONSTRUCTORS(InstallationValidator); |
| 212 }; | 212 }; |
| 213 | 213 |
| 214 } // namespace installer | 214 } // namespace installer |
| 215 | 215 |
| 216 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_VALIDATOR_H_ | 216 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_VALIDATOR_H_ |
| OLD | NEW |