| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 public: | 30 public: |
| 31 class ProductBits { | 31 class ProductBits { |
| 32 public: | 32 public: |
| 33 // Bits that form the components of an installation type. | 33 // Bits that form the components of an installation type. |
| 34 enum { | 34 enum { |
| 35 CHROME_SINGLE = 0x01, | 35 CHROME_SINGLE = 0x01, |
| 36 CHROME_MULTI = 0x02, | 36 CHROME_MULTI = 0x02, |
| 37 CHROME_FRAME_SINGLE = 0x04, | 37 CHROME_FRAME_SINGLE = 0x04, |
| 38 CHROME_FRAME_MULTI = 0x08, | 38 CHROME_FRAME_MULTI = 0x08, |
| 39 CHROME_FRAME_READY_MODE = 0x10, | 39 CHROME_FRAME_READY_MODE = 0x10, |
| 40 CHROME_APP_HOST = 0x20, |
| 40 }; | 41 }; |
| 41 }; // class ProductBits | 42 }; // class ProductBits |
| 42 | 43 |
| 43 // Identifiers of all valid installation types. | 44 // Identifiers of all valid installation types. |
| 44 enum InstallationType { | 45 enum InstallationType { |
| 45 NO_PRODUCTS = 0, | 46 NO_PRODUCTS = 0, |
| 46 CHROME_SINGLE = | 47 CHROME_SINGLE = |
| 47 ProductBits::CHROME_SINGLE, | 48 ProductBits::CHROME_SINGLE, |
| 48 CHROME_MULTI = | 49 CHROME_MULTI = |
| 49 ProductBits::CHROME_MULTI, | 50 ProductBits::CHROME_MULTI, |
| 50 CHROME_FRAME_SINGLE = | 51 CHROME_FRAME_SINGLE = |
| 51 ProductBits::CHROME_FRAME_SINGLE, | 52 ProductBits::CHROME_FRAME_SINGLE, |
| 52 CHROME_FRAME_SINGLE_CHROME_SINGLE = | 53 CHROME_FRAME_SINGLE_CHROME_SINGLE = |
| 53 ProductBits::CHROME_FRAME_SINGLE | ProductBits::CHROME_SINGLE, | 54 ProductBits::CHROME_FRAME_SINGLE | ProductBits::CHROME_SINGLE, |
| 54 CHROME_FRAME_SINGLE_CHROME_MULTI = | 55 CHROME_FRAME_SINGLE_CHROME_MULTI = |
| 55 ProductBits::CHROME_FRAME_SINGLE | ProductBits::CHROME_MULTI, | 56 ProductBits::CHROME_FRAME_SINGLE | ProductBits::CHROME_MULTI, |
| 56 CHROME_FRAME_MULTI = | 57 CHROME_FRAME_MULTI = |
| 57 ProductBits::CHROME_FRAME_MULTI, | 58 ProductBits::CHROME_FRAME_MULTI, |
| 58 CHROME_FRAME_MULTI_CHROME_MULTI = | 59 CHROME_FRAME_MULTI_CHROME_MULTI = |
| 59 ProductBits::CHROME_FRAME_MULTI | ProductBits::CHROME_MULTI, | 60 ProductBits::CHROME_FRAME_MULTI | ProductBits::CHROME_MULTI, |
| 60 CHROME_FRAME_READY_MODE_CHROME_MULTI = | 61 CHROME_FRAME_READY_MODE_CHROME_MULTI = |
| 61 ProductBits::CHROME_FRAME_READY_MODE | ProductBits::CHROME_MULTI, | 62 ProductBits::CHROME_FRAME_READY_MODE | ProductBits::CHROME_MULTI, |
| 63 CHROME_APP_HOST = |
| 64 ProductBits::CHROME_APP_HOST, |
| 65 CHROME_APP_HOST_CHROME_FRAME_SINGLE = |
| 66 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_SINGLE, |
| 67 CHROME_APP_HOST_CHROME_FRAME_SINGLE_CHROME_MULTI = |
| 68 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_SINGLE | |
| 69 ProductBits::CHROME_MULTI, |
| 70 CHROME_APP_HOST_CHROME_FRAME_MULTI = |
| 71 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_MULTI, |
| 72 CHROME_APP_HOST_CHROME_FRAME_MULTI_CHROME_MULTI = |
| 73 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_MULTI | |
| 74 ProductBits::CHROME_MULTI, |
| 75 CHROME_APP_HOST_CHROME_MULTI = |
| 76 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_MULTI, |
| 77 CHROME_APP_HOST_CHROME_MULTI_CHROME_FRAME_READY_MODE = |
| 78 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_MULTI | |
| 79 ProductBits::CHROME_FRAME_READY_MODE, |
| 62 }; | 80 }; |
| 63 | 81 |
| 64 // Validates |machine_state| at user or system level, returning true if valid. | 82 // Validates |machine_state| at user or system level, returning true if valid. |
| 65 // |type| is populated in either case, although it is a best-guess when the | 83 // |type| is populated in either case, although it is a best-guess when the |
| 66 // method returns false. | 84 // method returns false. |
| 67 static bool ValidateInstallationTypeForState( | 85 static bool ValidateInstallationTypeForState( |
| 68 const InstallationState& machine_state, | 86 const InstallationState& machine_state, |
| 69 bool system_level, | 87 bool system_level, |
| 70 InstallationType* type); | 88 InstallationType* type); |
| 71 | 89 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 SwitchExpectations* expectations) const OVERRIDE; | 148 SwitchExpectations* expectations) const OVERRIDE; |
| 131 virtual void AddRenameSwitchExpectations( | 149 virtual void AddRenameSwitchExpectations( |
| 132 const InstallationState& machine_state, | 150 const InstallationState& machine_state, |
| 133 bool system_install, | 151 bool system_install, |
| 134 const ProductState& product_state, | 152 const ProductState& product_state, |
| 135 SwitchExpectations* expectations) const OVERRIDE; | 153 SwitchExpectations* expectations) const OVERRIDE; |
| 136 virtual bool UsageStatsAllowed( | 154 virtual bool UsageStatsAllowed( |
| 137 const ProductState& product_state) const OVERRIDE; | 155 const ProductState& product_state) const OVERRIDE; |
| 138 }; | 156 }; |
| 139 | 157 |
| 158 // Validation rules for Chrome App Host. |
| 159 class ChromeAppHostRules : public ProductRules { |
| 160 public: |
| 161 virtual BrowserDistribution::Type distribution_type() const OVERRIDE; |
| 162 virtual void AddUninstallSwitchExpectations( |
| 163 const InstallationState& machine_state, |
| 164 bool system_install, |
| 165 const ProductState& product_state, |
| 166 SwitchExpectations* expectations) const OVERRIDE; |
| 167 virtual void AddRenameSwitchExpectations( |
| 168 const InstallationState& machine_state, |
| 169 bool system_install, |
| 170 const ProductState& product_state, |
| 171 SwitchExpectations* expectations) const OVERRIDE; |
| 172 virtual bool UsageStatsAllowed( |
| 173 const ProductState& product_state) const OVERRIDE; |
| 174 }; |
| 175 |
| 140 // Validation rules for the multi-install Chrome binaries. | 176 // Validation rules for the multi-install Chrome binaries. |
| 141 class ChromeBinariesRules : public ProductRules { | 177 class ChromeBinariesRules : public ProductRules { |
| 142 public: | 178 public: |
| 143 virtual BrowserDistribution::Type distribution_type() const OVERRIDE; | 179 virtual BrowserDistribution::Type distribution_type() const OVERRIDE; |
| 144 virtual void AddUninstallSwitchExpectations( | 180 virtual void AddUninstallSwitchExpectations( |
| 145 const InstallationState& machine_state, | 181 const InstallationState& machine_state, |
| 146 bool system_install, | 182 bool system_install, |
| 147 const ProductState& product_state, | 183 const ProductState& product_state, |
| 148 SwitchExpectations* expectations) const OVERRIDE; | 184 SwitchExpectations* expectations) const OVERRIDE; |
| 149 virtual void AddRenameSwitchExpectations( | 185 virtual void AddRenameSwitchExpectations( |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 // A collection of all valid installation types. | 244 // A collection of all valid installation types. |
| 209 static const InstallationType kInstallationTypes[]; | 245 static const InstallationType kInstallationTypes[]; |
| 210 | 246 |
| 211 private: | 247 private: |
| 212 DISALLOW_IMPLICIT_CONSTRUCTORS(InstallationValidator); | 248 DISALLOW_IMPLICIT_CONSTRUCTORS(InstallationValidator); |
| 213 }; | 249 }; |
| 214 | 250 |
| 215 } // namespace installer | 251 } // namespace installer |
| 216 | 252 |
| 217 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_VALIDATOR_H_ | 253 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_VALIDATOR_H_ |
| OLD | NEW |