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 21 matching lines...) Expand all Loading... |
32 class InstallationValidator { | 32 class InstallationValidator { |
33 public: | 33 public: |
34 class ProductBits { | 34 class ProductBits { |
35 public: | 35 public: |
36 // Bits that form the components of an installation type. | 36 // Bits that form the components of an installation type. |
37 enum { | 37 enum { |
38 CHROME_SINGLE = 0x01, | 38 CHROME_SINGLE = 0x01, |
39 CHROME_MULTI = 0x02, | 39 CHROME_MULTI = 0x02, |
40 CHROME_FRAME_SINGLE = 0x04, | 40 CHROME_FRAME_SINGLE = 0x04, |
41 CHROME_FRAME_MULTI = 0x08, | 41 CHROME_FRAME_MULTI = 0x08, |
42 CHROME_FRAME_READY_MODE = 0x10, | 42 CHROME_APP_HOST = 0x10, |
43 CHROME_APP_HOST = 0x20, | |
44 }; | 43 }; |
45 }; // class ProductBits | 44 }; // class ProductBits |
46 | 45 |
47 // Identifiers of all valid installation types. | 46 // Identifiers of all valid installation types. |
48 enum InstallationType { | 47 enum InstallationType { |
49 NO_PRODUCTS = 0, | 48 NO_PRODUCTS = 0, |
50 CHROME_SINGLE = | 49 CHROME_SINGLE = |
51 ProductBits::CHROME_SINGLE, | 50 ProductBits::CHROME_SINGLE, |
52 CHROME_MULTI = | 51 CHROME_MULTI = |
53 ProductBits::CHROME_MULTI, | 52 ProductBits::CHROME_MULTI, |
54 CHROME_FRAME_SINGLE = | 53 CHROME_FRAME_SINGLE = |
55 ProductBits::CHROME_FRAME_SINGLE, | 54 ProductBits::CHROME_FRAME_SINGLE, |
56 CHROME_FRAME_SINGLE_CHROME_SINGLE = | 55 CHROME_FRAME_SINGLE_CHROME_SINGLE = |
57 ProductBits::CHROME_FRAME_SINGLE | ProductBits::CHROME_SINGLE, | 56 ProductBits::CHROME_FRAME_SINGLE | ProductBits::CHROME_SINGLE, |
58 CHROME_FRAME_SINGLE_CHROME_MULTI = | 57 CHROME_FRAME_SINGLE_CHROME_MULTI = |
59 ProductBits::CHROME_FRAME_SINGLE | ProductBits::CHROME_MULTI, | 58 ProductBits::CHROME_FRAME_SINGLE | ProductBits::CHROME_MULTI, |
60 CHROME_FRAME_MULTI = | 59 CHROME_FRAME_MULTI = |
61 ProductBits::CHROME_FRAME_MULTI, | 60 ProductBits::CHROME_FRAME_MULTI, |
62 CHROME_FRAME_MULTI_CHROME_MULTI = | 61 CHROME_FRAME_MULTI_CHROME_MULTI = |
63 ProductBits::CHROME_FRAME_MULTI | ProductBits::CHROME_MULTI, | 62 ProductBits::CHROME_FRAME_MULTI | ProductBits::CHROME_MULTI, |
64 CHROME_FRAME_READY_MODE_CHROME_MULTI = | |
65 ProductBits::CHROME_FRAME_READY_MODE | ProductBits::CHROME_MULTI, | |
66 CHROME_APP_HOST = | 63 CHROME_APP_HOST = |
67 ProductBits::CHROME_APP_HOST, | 64 ProductBits::CHROME_APP_HOST, |
68 CHROME_APP_HOST_CHROME_FRAME_SINGLE = | 65 CHROME_APP_HOST_CHROME_FRAME_SINGLE = |
69 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_SINGLE, | 66 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_SINGLE, |
70 CHROME_APP_HOST_CHROME_FRAME_SINGLE_CHROME_MULTI = | 67 CHROME_APP_HOST_CHROME_FRAME_SINGLE_CHROME_MULTI = |
71 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_SINGLE | | 68 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_SINGLE | |
72 ProductBits::CHROME_MULTI, | 69 ProductBits::CHROME_MULTI, |
73 CHROME_APP_HOST_CHROME_FRAME_MULTI = | 70 CHROME_APP_HOST_CHROME_FRAME_MULTI = |
74 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_MULTI, | 71 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_MULTI, |
75 CHROME_APP_HOST_CHROME_FRAME_MULTI_CHROME_MULTI = | 72 CHROME_APP_HOST_CHROME_FRAME_MULTI_CHROME_MULTI = |
76 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_MULTI | | 73 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_FRAME_MULTI | |
77 ProductBits::CHROME_MULTI, | 74 ProductBits::CHROME_MULTI, |
78 CHROME_APP_HOST_CHROME_MULTI = | 75 CHROME_APP_HOST_CHROME_MULTI = |
79 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_MULTI, | 76 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_MULTI, |
80 CHROME_APP_HOST_CHROME_MULTI_CHROME_FRAME_READY_MODE = | |
81 ProductBits::CHROME_APP_HOST | ProductBits::CHROME_MULTI | | |
82 ProductBits::CHROME_FRAME_READY_MODE, | |
83 }; | 77 }; |
84 | 78 |
85 // Validates |machine_state| at user or system level, returning true if valid. | 79 // Validates |machine_state| at user or system level, returning true if valid. |
86 // |type| is populated in either case, although it is a best-guess when the | 80 // |type| is populated in either case, although it is a best-guess when the |
87 // method returns false. | 81 // method returns false. |
88 static bool ValidateInstallationTypeForState( | 82 static bool ValidateInstallationTypeForState( |
89 const InstallationState& machine_state, | 83 const InstallationState& machine_state, |
90 bool system_level, | 84 bool system_level, |
91 InstallationType* type); | 85 InstallationType* type); |
92 | 86 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // A collection of all valid installation types. | 260 // A collection of all valid installation types. |
267 static const InstallationType kInstallationTypes[]; | 261 static const InstallationType kInstallationTypes[]; |
268 | 262 |
269 private: | 263 private: |
270 DISALLOW_IMPLICIT_CONSTRUCTORS(InstallationValidator); | 264 DISALLOW_IMPLICIT_CONSTRUCTORS(InstallationValidator); |
271 }; | 265 }; |
272 | 266 |
273 } // namespace installer | 267 } // namespace installer |
274 | 268 |
275 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_VALIDATOR_H_ | 269 #endif // CHROME_INSTALLER_UTIL_INSTALLATION_VALIDATOR_H_ |
OLD | NEW |