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 // This file declares utility functions for the installer. The original reason | 5 // This file declares utility functions for the installer. The original reason |
6 // for putting these functions in installer\util library is so that we can | 6 // for putting these functions in installer\util library is so that we can |
7 // separate out the critical logic and write unit tests for it. | 7 // separate out the critical logic and write unit tests for it. |
8 | 8 |
9 #ifndef CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ | 9 #ifndef CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ |
10 #define CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ | 10 #define CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 namespace base { | 26 namespace base { |
27 class Version; | 27 class Version; |
28 } | 28 } |
29 | 29 |
30 // This is a utility class that provides common installation related | 30 // This is a utility class that provides common installation related |
31 // utility methods that can be used by installer and also unit tested | 31 // utility methods that can be used by installer and also unit tested |
32 // independently. | 32 // independently. |
33 class InstallUtil { | 33 class InstallUtil { |
34 public: | 34 public: |
| 35 // The components of the Active Setup Version entry, in order. |
| 36 enum ActiveSetupVersionComponent { |
| 37 // The major version. |
| 38 MAJOR, |
| 39 // Unused component, always 0 for now. |
| 40 UNUSED1, |
| 41 // Number of OS upgrades handled since original install. |
| 42 OS_UPGRADES, |
| 43 // Unused component, always 0 for now. |
| 44 UNUSED2, |
| 45 }; |
| 46 |
| 47 // The set of operations that can be performed on an |
| 48 // ActiveSetupVersionComponent. |
| 49 enum ActiveSetupVersionOperation { |
| 50 // Sets the ActiveSetupVersionComponent operated on to the value specified. |
| 51 SET, |
| 52 // Bumps the ActiveSetupVersionComponent operated on by the value specified. |
| 53 BUMP, |
| 54 }; |
| 55 |
| 56 // Returns the updated Active Setup version once |operation|+|value| is |
| 57 // applied to |component| of |existing_version|. |
| 58 static base::string16 GetActiveSetupVersionFromExisting( |
| 59 ActiveSetupVersionComponent component, |
| 60 ActiveSetupVersionOperation operation, |
| 61 int value, |
| 62 const base::string16& existing_version); |
| 63 |
| 64 // Updates the Active Setup version for |dist| as dictated by |component|, |
| 65 // |operation|, and |value|. Requires an Active Setup version to already be |
| 66 // installed for |dist|. Returns true on success. |
| 67 static bool UpdateActiveSetupVersion(BrowserDistribution* dist, |
| 68 ActiveSetupVersionComponent component, |
| 69 ActiveSetupVersionOperation operation, |
| 70 int value); |
| 71 |
35 // Get the path to this distribution's Active Setup registry entries. | 72 // Get the path to this distribution's Active Setup registry entries. |
36 // e.g. Software\Microsoft\Active Setup\Installed Components\<dist_guid> | 73 // e.g. Software\Microsoft\Active Setup\Installed Components\<dist_guid> |
37 static base::string16 GetActiveSetupPath(BrowserDistribution* dist); | 74 static base::string16 GetActiveSetupPath(BrowserDistribution* dist); |
38 | 75 |
39 // Attempts to trigger the command that would be run by Active Setup for a | 76 // Attempts to trigger the command that would be run by Active Setup for a |
40 // system-level Chrome. For use only when system-level Chrome is installed. | 77 // system-level Chrome. For use only when system-level Chrome is installed. |
41 static void TriggerActiveSetupCommand(); | 78 static void TriggerActiveSetupCommand(); |
42 | 79 |
43 // Launches given exe as admin on Vista. | 80 // Launches given exe as admin on Vista. |
44 static bool ExecuteExeAsAdmin(const base::CommandLine& cmd, DWORD* exit_code); | 81 static bool ExecuteExeAsAdmin(const base::CommandLine& cmd, DWORD* exit_code); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 private: | 243 private: |
207 DISALLOW_COPY_AND_ASSIGN(ProgramCompare); | 244 DISALLOW_COPY_AND_ASSIGN(ProgramCompare); |
208 }; // class ProgramCompare | 245 }; // class ProgramCompare |
209 | 246 |
210 private: | 247 private: |
211 DISALLOW_COPY_AND_ASSIGN(InstallUtil); | 248 DISALLOW_COPY_AND_ASSIGN(InstallUtil); |
212 }; | 249 }; |
213 | 250 |
214 | 251 |
215 #endif // CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ | 252 #endif // CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ |
OLD | NEW |