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 23 matching lines...) Expand all Loading... |
34 public: | 34 public: |
35 // Get the path to this distribution's Active Setup registry entries. | 35 // Get the path to this distribution's Active Setup registry entries. |
36 // e.g. Software\Microsoft\Active Setup\Installed Components\<dist_guid> | 36 // e.g. Software\Microsoft\Active Setup\Installed Components\<dist_guid> |
37 static base::string16 GetActiveSetupPath(BrowserDistribution* dist); | 37 static base::string16 GetActiveSetupPath(BrowserDistribution* dist); |
38 | 38 |
39 // Attempts to trigger the command that would be run by Active Setup for a | 39 // 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. | 40 // system-level Chrome. For use only when system-level Chrome is installed. |
41 static void TriggerActiveSetupCommand(); | 41 static void TriggerActiveSetupCommand(); |
42 | 42 |
43 // Launches given exe as admin on Vista. | 43 // Launches given exe as admin on Vista. |
44 static bool ExecuteExeAsAdmin(const CommandLine& cmd, DWORD* exit_code); | 44 static bool ExecuteExeAsAdmin(const base::CommandLine& cmd, DWORD* exit_code); |
45 | 45 |
46 // Reads the uninstall command for Chromium from registry and returns it. | 46 // Reads the uninstall command for Chromium from registry and returns it. |
47 // If system_install is true the command is read from HKLM, otherwise | 47 // If system_install is true the command is read from HKLM, otherwise |
48 // from HKCU. | 48 // from HKCU. |
49 static CommandLine GetChromeUninstallCmd( | 49 static base::CommandLine GetChromeUninstallCmd( |
50 bool system_install, | 50 bool system_install, |
51 BrowserDistribution::Type distribution_type); | 51 BrowserDistribution::Type distribution_type); |
52 | 52 |
53 // Find the version of Chrome installed on the system by checking the | 53 // Find the version of Chrome installed on the system by checking the |
54 // Google Update registry key. Fills |version| with the version or a | 54 // Google Update registry key. Fills |version| with the version or a |
55 // default-constructed Version if no version is found. | 55 // default-constructed Version if no version is found. |
56 // system_install: if true, looks for version number under the HKLM root, | 56 // system_install: if true, looks for version number under the HKLM root, |
57 // otherwise looks under the HKCU. | 57 // otherwise looks under the HKCU. |
58 static void GetChromeVersion(BrowserDistribution* dist, | 58 static void GetChromeVersion(BrowserDistribution* dist, |
59 bool system_install, | 59 bool system_install, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 private: | 166 private: |
167 DISALLOW_COPY_AND_ASSIGN(ValueEquals); | 167 DISALLOW_COPY_AND_ASSIGN(ValueEquals); |
168 }; | 168 }; |
169 | 169 |
170 // Returns zero on install success, or an InstallStatus value otherwise. | 170 // Returns zero on install success, or an InstallStatus value otherwise. |
171 static int GetInstallReturnCode(installer::InstallStatus install_status); | 171 static int GetInstallReturnCode(installer::InstallStatus install_status); |
172 | 172 |
173 // Composes |program| and |arguments| into |command_line|. | 173 // Composes |program| and |arguments| into |command_line|. |
174 static void MakeUninstallCommand(const base::string16& program, | 174 static void MakeUninstallCommand(const base::string16& program, |
175 const base::string16& arguments, | 175 const base::string16& arguments, |
176 CommandLine* command_line); | 176 base::CommandLine* command_line); |
177 | 177 |
178 // Returns a string in the form YYYYMMDD of the current date. | 178 // Returns a string in the form YYYYMMDD of the current date. |
179 static base::string16 GetCurrentDate(); | 179 static base::string16 GetCurrentDate(); |
180 | 180 |
181 // A predicate that compares the program portion of a command line with a | 181 // A predicate that compares the program portion of a command line with a |
182 // given file path. First, the file paths are compared directly. If they do | 182 // given file path. First, the file paths are compared directly. If they do |
183 // not match, the filesystem is consulted to determine if the paths reference | 183 // not match, the filesystem is consulted to determine if the paths reference |
184 // the same file. | 184 // the same file. |
185 class ProgramCompare : public RegistryValuePredicate { | 185 class ProgramCompare : public RegistryValuePredicate { |
186 public: | 186 public: |
(...skipping 14 matching lines...) Expand all Loading... |
201 private: | 201 private: |
202 DISALLOW_COPY_AND_ASSIGN(ProgramCompare); | 202 DISALLOW_COPY_AND_ASSIGN(ProgramCompare); |
203 }; // class ProgramCompare | 203 }; // class ProgramCompare |
204 | 204 |
205 private: | 205 private: |
206 DISALLOW_COPY_AND_ASSIGN(InstallUtil); | 206 DISALLOW_COPY_AND_ASSIGN(InstallUtil); |
207 }; | 207 }; |
208 | 208 |
209 | 209 |
210 #endif // CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ | 210 #endif // CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ |
OLD | NEW |