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 20 matching lines...) Expand all Loading... |
31 class InstallationValidator { | 31 class InstallationValidator { |
32 public: | 32 public: |
33 class ProductBits { | 33 class ProductBits { |
34 public: | 34 public: |
35 // Bits that form the components of an installation type. | 35 // Bits that form the components of an installation type. |
36 enum { | 36 enum { |
37 CHROME_SINGLE = 0x01, | 37 CHROME_SINGLE = 0x01, |
38 CHROME_MULTI = 0x02, | 38 CHROME_MULTI = 0x02, |
39 CHROME_FRAME_SINGLE = 0x04, | 39 CHROME_FRAME_SINGLE = 0x04, |
40 CHROME_FRAME_MULTI = 0x08, | 40 CHROME_FRAME_MULTI = 0x08, |
41 CHROME_APP_HOST = 0x10, | |
42 }; | 41 }; |
43 }; // class ProductBits | 42 }; // class ProductBits |
44 | 43 |
45 // Identifiers of all valid installation types. | 44 // Identifiers of all valid installation types. |
46 enum InstallationType { | 45 enum InstallationType { |
47 NO_PRODUCTS = 0, | 46 NO_PRODUCTS = 0, |
48 CHROME_SINGLE = | 47 CHROME_SINGLE = |
49 ProductBits::CHROME_SINGLE, | 48 ProductBits::CHROME_SINGLE, |
50 CHROME_MULTI = | 49 CHROME_MULTI = |
51 ProductBits::CHROME_MULTI, | 50 ProductBits::CHROME_MULTI, |
52 CHROME_FRAME_SINGLE = | 51 CHROME_FRAME_SINGLE = |
53 ProductBits::CHROME_FRAME_SINGLE, | 52 ProductBits::CHROME_FRAME_SINGLE, |
54 CHROME_FRAME_SINGLE_CHROME_SINGLE = | 53 CHROME_FRAME_SINGLE_CHROME_SINGLE = |
55 ProductBits::CHROME_FRAME_SINGLE | ProductBits::CHROME_SINGLE, | 54 ProductBits::CHROME_FRAME_SINGLE | ProductBits::CHROME_SINGLE, |
56 CHROME_FRAME_SINGLE_CHROME_MULTI = | 55 CHROME_FRAME_SINGLE_CHROME_MULTI = |
57 ProductBits::CHROME_FRAME_SINGLE | ProductBits::CHROME_MULTI, | 56 ProductBits::CHROME_FRAME_SINGLE | ProductBits::CHROME_MULTI, |
58 CHROME_FRAME_MULTI = | 57 CHROME_FRAME_MULTI = |
59 ProductBits::CHROME_FRAME_MULTI, | 58 ProductBits::CHROME_FRAME_MULTI, |
60 CHROME_FRAME_MULTI_CHROME_MULTI = | 59 CHROME_FRAME_MULTI_CHROME_MULTI = |
61 ProductBits::CHROME_FRAME_MULTI | ProductBits::CHROME_MULTI, | 60 ProductBits::CHROME_FRAME_MULTI | ProductBits::CHROME_MULTI, |
62 CHROME_APP_HOST = | |
63 ProductBits::CHROME_APP_HOST, | |
64 CHROME_APP_HOST_CHROME_FRAME_SINGLE = | |
65 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_SINGLE, | |
66 CHROME_APP_HOST_CHROME_FRAME_SINGLE_CHROME_MULTI = | |
67 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_SINGLE | | |
68 ProductBits::CHROME_MULTI, | |
69 CHROME_APP_HOST_CHROME_FRAME_MULTI = | |
70 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_MULTI, | |
71 CHROME_APP_HOST_CHROME_FRAME_MULTI_CHROME_MULTI = | |
72 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_MULTI | | |
73 ProductBits::CHROME_MULTI, | |
74 CHROME_APP_HOST_CHROME_MULTI = | |
75 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_MULTI, | |
76 }; | 61 }; |
77 | 62 |
78 // Validates |machine_state| at user or system level, returning true if valid. | 63 // Validates |machine_state| at user or system level, returning true if valid. |
79 // |type| is populated in either case, although it is a best-guess when the | 64 // |type| is populated in either case, although it is a best-guess when the |
80 // method returns false. | 65 // method returns false. |
81 static bool ValidateInstallationTypeForState( | 66 static bool ValidateInstallationTypeForState( |
82 const InstallationState& machine_state, | 67 const InstallationState& machine_state, |
83 bool system_level, | 68 bool system_level, |
84 InstallationType* type); | 69 InstallationType* type); |
85 | 70 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 virtual BrowserDistribution::Type distribution_type() const override; | 115 virtual BrowserDistribution::Type distribution_type() const override; |
131 virtual void AddUninstallSwitchExpectations( | 116 virtual void AddUninstallSwitchExpectations( |
132 const ProductContext& ctx, | 117 const ProductContext& ctx, |
133 SwitchExpectations* expectations) const override; | 118 SwitchExpectations* expectations) const override; |
134 virtual void AddRenameSwitchExpectations( | 119 virtual void AddRenameSwitchExpectations( |
135 const ProductContext& ctx, | 120 const ProductContext& ctx, |
136 SwitchExpectations* expectations) const override; | 121 SwitchExpectations* expectations) const override; |
137 virtual bool UsageStatsAllowed(const ProductContext& ctx) const override; | 122 virtual bool UsageStatsAllowed(const ProductContext& ctx) const override; |
138 }; | 123 }; |
139 | 124 |
140 // Validation rules for Chrome App Host. | |
141 class ChromeAppHostRules : public ProductRules { | |
142 public: | |
143 virtual BrowserDistribution::Type distribution_type() const override; | |
144 virtual void AddUninstallSwitchExpectations( | |
145 const ProductContext& ctx, | |
146 SwitchExpectations* expectations) const override; | |
147 virtual void AddRenameSwitchExpectations( | |
148 const ProductContext& ctx, | |
149 SwitchExpectations* expectations) const override; | |
150 virtual bool UsageStatsAllowed(const ProductContext& ctx) const override; | |
151 }; | |
152 | |
153 // Validation rules for the multi-install Chrome binaries. | 125 // Validation rules for the multi-install Chrome binaries. |
154 class ChromeBinariesRules : public ProductRules { | 126 class ChromeBinariesRules : public ProductRules { |
155 public: | 127 public: |
156 virtual BrowserDistribution::Type distribution_type() const override; | 128 virtual BrowserDistribution::Type distribution_type() const override; |
157 virtual void AddUninstallSwitchExpectations( | 129 virtual void AddUninstallSwitchExpectations( |
158 const ProductContext& ctx, | 130 const ProductContext& ctx, |
159 SwitchExpectations* expectations) const override; | 131 SwitchExpectations* expectations) const override; |
160 virtual void AddRenameSwitchExpectations( | 132 virtual void AddRenameSwitchExpectations( |
161 const ProductContext& ctx, | 133 const ProductContext& ctx, |
162 SwitchExpectations* expectations) const override; | 134 SwitchExpectations* expectations) const override; |
(...skipping 25 matching lines...) Expand all Loading... |
188 // presence/absence of bool variables. | 160 // presence/absence of bool variables. |
189 static void ValidateAppCommandFlags( | 161 static void ValidateAppCommandFlags( |
190 const ProductContext& ctx, | 162 const ProductContext& ctx, |
191 const AppCommand& app_cmd, | 163 const AppCommand& app_cmd, |
192 const std::set<base::string16>& flags_expected, | 164 const std::set<base::string16>& flags_expected, |
193 const base::string16& name, | 165 const base::string16& name, |
194 bool* is_valid); | 166 bool* is_valid); |
195 static void ValidateOnOsUpgradeCommand(const ProductContext& ctx, | 167 static void ValidateOnOsUpgradeCommand(const ProductContext& ctx, |
196 const AppCommand& app_cmd, | 168 const AppCommand& app_cmd, |
197 bool* is_valid); | 169 bool* is_valid); |
198 static void ValidateQueryEULAAcceptanceCommand(const ProductContext& ctx, | |
199 const AppCommand& app_cmd, | |
200 bool* is_valid); | |
201 static void ValidateQuickEnableApplicationHostCommand( | |
202 const ProductContext& ctx, | |
203 const AppCommand& app_cmd, | |
204 bool* is_valid); | |
205 | |
206 static void ValidateAppCommandExpectations( | 170 static void ValidateAppCommandExpectations( |
207 const ProductContext& ctx, | 171 const ProductContext& ctx, |
208 const CommandExpectations& expectations, | 172 const CommandExpectations& expectations, |
209 bool* is_valid); | 173 bool* is_valid); |
210 static void ValidateBinariesCommands(const ProductContext& ctx, | |
211 bool* is_valid); | |
212 static void ValidateBinaries(const InstallationState& machine_state, | 174 static void ValidateBinaries(const InstallationState& machine_state, |
213 bool system_install, | 175 bool system_install, |
214 const ProductState& binaries_state, | 176 const ProductState& binaries_state, |
215 bool* is_valid); | 177 bool* is_valid); |
216 static void ValidateSetupPath(const ProductContext& ctx, | 178 static void ValidateSetupPath(const ProductContext& ctx, |
217 const base::FilePath& setup_exe, | 179 const base::FilePath& setup_exe, |
218 const base::string16& purpose, | 180 const base::string16& purpose, |
219 bool* is_valid); | 181 bool* is_valid); |
220 static void ValidateCommandExpectations(const ProductContext& ctx, | 182 static void ValidateCommandExpectations(const ProductContext& ctx, |
221 const base::CommandLine& command, | 183 const base::CommandLine& command, |
(...skipping 23 matching lines...) Expand all Loading... |
245 // A collection of all valid installation types. | 207 // A collection of all valid installation types. |
246 static const InstallationType kInstallationTypes[]; | 208 static const InstallationType kInstallationTypes[]; |
247 | 209 |
248 private: | 210 private: |
249 DISALLOW_IMPLICIT_CONSTRUCTORS(InstallationValidator); | 211 DISALLOW_IMPLICIT_CONSTRUCTORS(InstallationValidator); |
250 }; | 212 }; |
251 | 213 |
252 } // namespace installer | 214 } // namespace installer |
253 | 215 |
254 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_VALIDATOR_H_ | 216 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_VALIDATOR_H_ |
OLD | NEW |