Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: chrome/installer/util/installation_validator.h

Issue 10823437: Callback flow to register Chrome and update shortcuts after OS upgrade to Windows 8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Abandoning the use of ON_OS_UPGRADE_SUCCESSFUL installer message. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <string>
10 #include <utility> 9 #include <utility>
11 #include <vector> 10 #include <vector>
12 11
13 #include "base/basictypes.h" 12 #include "base/basictypes.h"
14 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/string16.h"
15 #include "chrome/installer/util/browser_distribution.h" 15 #include "chrome/installer/util/browser_distribution.h"
16 16
17 class CommandLine; 17 class CommandLine;
18 class FilePath; 18 class FilePath;
19 19
20 namespace installer { 20 namespace installer {
21 21
22 class InstallationState; 22 class InstallationState;
23 class AppCommand; 23 class AppCommand;
24 class ProductState; 24 class ProductState;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // returning true and populating |type| if valid. 90 // returning true and populating |type| if valid.
91 static bool ValidateInstallationType(bool system_level, 91 static bool ValidateInstallationType(bool system_level,
92 InstallationType* type); 92 InstallationType* type);
93 93
94 protected: 94 protected:
95 struct ProductContext; 95 struct ProductContext;
96 typedef std::vector<std::pair<std::string, bool> > SwitchExpectations; 96 typedef std::vector<std::pair<std::string, bool> > SwitchExpectations;
97 typedef void (*CommandValidatorFn)(const ProductContext& ctx, 97 typedef void (*CommandValidatorFn)(const ProductContext& ctx,
98 const AppCommand& command, 98 const AppCommand& command,
99 bool* is_valid); 99 bool* is_valid);
100 typedef std::map<std::wstring, CommandValidatorFn> CommandExpectations; 100 typedef std::map<string16, CommandValidatorFn> CommandExpectations;
101 101
102 // An interface to product-specific validation rules. 102 // An interface to product-specific validation rules.
103 class ProductRules { 103 class ProductRules {
104 public: 104 public:
105 virtual ~ProductRules() { } 105 virtual ~ProductRules() { }
106 virtual BrowserDistribution::Type distribution_type() const = 0; 106 virtual BrowserDistribution::Type distribution_type() const = 0;
107 virtual void AddUninstallSwitchExpectations( 107 virtual void AddUninstallSwitchExpectations(
108 const InstallationState& machine_state, 108 const InstallationState& machine_state,
109 bool system_install, 109 bool system_install,
110 const ProductState& product_state, 110 const ProductState& product_state,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 virtual void AddRenameSwitchExpectations( 184 virtual void AddRenameSwitchExpectations(
185 const InstallationState& machine_state, 185 const InstallationState& machine_state,
186 bool system_install, 186 bool system_install,
187 const ProductState& product_state, 187 const ProductState& product_state,
188 SwitchExpectations* expectations) const OVERRIDE; 188 SwitchExpectations* expectations) const OVERRIDE;
189 virtual bool UsageStatsAllowed( 189 virtual bool UsageStatsAllowed(
190 const ProductState& product_state) const OVERRIDE; 190 const ProductState& product_state) const OVERRIDE;
191 }; 191 };
192 192
193 struct ProductContext { 193 struct ProductContext {
194 ProductContext(const InstallationState& machine_state_in,
195 const bool system_install_in,
gab 2012/08/30 14:24:32 chromium-style: Don't need to make POD type parame
huangs 2012/08/30 17:13:07 Done.
196 const ProductState& state_in,
197 const ProductRules& rules_in)
198 : machine_state(machine_state_in),
199 system_install(system_install_in),
200 dist(BrowserDistribution::GetSpecificDistribution(
201 rules_in.distribution_type())),
202 state(state_in),
203 rules(rules_in) {
204 }
205
194 const InstallationState& machine_state; 206 const InstallationState& machine_state;
195 bool system_install; 207 bool system_install;
196 BrowserDistribution* dist; 208 BrowserDistribution* dist;
197 const ProductState& state; 209 const ProductState& state;
198 const ProductRules& rules; 210 const ProductRules& rules;
199 }; 211 };
200 212
213 static void ValidateOnOsUpgradeCommand(const ProductContext& ctx,
214 const AppCommand& command,
215 bool* is_valid);
201 static void ValidateInstallAppCommand(const ProductContext& ctx, 216 static void ValidateInstallAppCommand(const ProductContext& ctx,
202 const AppCommand& command, 217 const AppCommand& command,
203 bool* is_valid); 218 bool* is_valid);
204 static void ValidateQuickEnableCfCommand(const ProductContext& ctx, 219 static void ValidateQuickEnableCfCommand(const ProductContext& ctx,
205 const AppCommand& command, 220 const AppCommand& command,
206 bool* is_valid); 221 bool* is_valid);
207 static void ValidateQuickEnableApplicationHostCommand( 222 static void ValidateQuickEnableApplicationHostCommand(
208 const ProductContext& ctx, 223 const ProductContext& ctx,
209 const AppCommand& command, 224 const AppCommand& command,
210 bool* is_valid); 225 bool* is_valid);
211 226
212 static void ValidateAppCommandExpectations( 227 static void ValidateAppCommandExpectations(
213 const ProductContext& ctx, 228 const ProductContext& ctx,
(...skipping 21 matching lines...) Expand all
235 static void ValidateRenameCommand(const ProductContext& ctx, 250 static void ValidateRenameCommand(const ProductContext& ctx,
236 bool* is_valid); 251 bool* is_valid);
237 static void ValidateOldVersionValues(const ProductContext& ctx, 252 static void ValidateOldVersionValues(const ProductContext& ctx,
238 bool* is_valid); 253 bool* is_valid);
239 static void ValidateMultiInstallProduct(const ProductContext& ctx, 254 static void ValidateMultiInstallProduct(const ProductContext& ctx,
240 bool* is_valid); 255 bool* is_valid);
241 static void ValidateAppCommands(const ProductContext& ctx, 256 static void ValidateAppCommands(const ProductContext& ctx,
242 bool* is_valid); 257 bool* is_valid);
243 static void ValidateUsageStats(const ProductContext& ctx, 258 static void ValidateUsageStats(const ProductContext& ctx,
244 bool* is_valid); 259 bool* is_valid);
245 static void ValidateProduct(const InstallationState& machine_state, 260 static void ValidateProduct(const ProductContext& ctx,
246 bool system_install,
247 const ProductState& product_state,
248 const ProductRules& rules,
249 bool* is_valid); 261 bool* is_valid);
250 262
251 // A collection of all valid installation types. 263 // A collection of all valid installation types.
252 static const InstallationType kInstallationTypes[]; 264 static const InstallationType kInstallationTypes[];
253 265
254 private: 266 private:
255 DISALLOW_IMPLICIT_CONSTRUCTORS(InstallationValidator); 267 DISALLOW_IMPLICIT_CONSTRUCTORS(InstallationValidator);
256 }; 268 };
257 269
258 } // namespace installer 270 } // namespace installer
259 271
260 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_VALIDATOR_H_ 272 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_VALIDATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698