| 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_ |
| 11 | 11 |
| 12 #include <windows.h> | 12 #include <windows.h> |
| 13 #include <tchar.h> | 13 #include <tchar.h> |
| 14 | 14 |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
| 18 #include "base/string16.h" | 18 #include "base/string16.h" |
| 19 #include "base/win/scoped_handle.h" | 19 #include "base/win/scoped_handle.h" |
| 20 #include "chrome/installer/util/browser_distribution.h" | 20 #include "chrome/installer/util/browser_distribution.h" |
| 21 #include "chrome/installer/util/util_constants.h" | 21 #include "chrome/installer/util/util_constants.h" |
| 22 | 22 |
| 23 class WorkItemList; |
| 24 |
| 25 namespace base { |
| 23 class Version; | 26 class Version; |
| 24 class WorkItemList; | 27 } |
| 25 | 28 |
| 26 // This is a utility class that provides common installation related | 29 // This is a utility class that provides common installation related |
| 27 // utility methods that can be used by installer and also unit tested | 30 // utility methods that can be used by installer and also unit tested |
| 28 // independently. | 31 // independently. |
| 29 class InstallUtil { | 32 class InstallUtil { |
| 30 public: | 33 public: |
| 31 // Get the path to this distribution's Active Setup registry entries. | 34 // Get the path to this distribution's Active Setup registry entries. |
| 32 // e.g. Software\Microsoft\Active Setup\Installed Components\<dist_guid> | 35 // e.g. Software\Microsoft\Active Setup\Installed Components\<dist_guid> |
| 33 static string16 GetActiveSetupPath(BrowserDistribution* dist); | 36 static string16 GetActiveSetupPath(BrowserDistribution* dist); |
| 34 | 37 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 46 bool system_install, | 49 bool system_install, |
| 47 BrowserDistribution::Type distribution_type); | 50 BrowserDistribution::Type distribution_type); |
| 48 | 51 |
| 49 // Find the version of Chrome installed on the system by checking the | 52 // Find the version of Chrome installed on the system by checking the |
| 50 // Google Update registry key. Fills |version| with the version or a | 53 // Google Update registry key. Fills |version| with the version or a |
| 51 // default-constructed Version if no version is found. | 54 // default-constructed Version if no version is found. |
| 52 // system_install: if true, looks for version number under the HKLM root, | 55 // system_install: if true, looks for version number under the HKLM root, |
| 53 // otherwise looks under the HKCU. | 56 // otherwise looks under the HKCU. |
| 54 static void GetChromeVersion(BrowserDistribution* dist, | 57 static void GetChromeVersion(BrowserDistribution* dist, |
| 55 bool system_install, | 58 bool system_install, |
| 56 Version* version); | 59 base::Version* version); |
| 57 | 60 |
| 58 // Find the last critical update (version) of Chrome. Fills |version| with the | 61 // Find the last critical update (version) of Chrome. Fills |version| with the |
| 59 // version or a default-constructed Version if no version is found. A critical | 62 // version or a default-constructed Version if no version is found. A critical |
| 60 // update is a specially flagged version (by Google Update) that contains an | 63 // update is a specially flagged version (by Google Update) that contains an |
| 61 // important security fix. | 64 // important security fix. |
| 62 // system_install: if true, looks for version number under the HKLM root, | 65 // system_install: if true, looks for version number under the HKLM root, |
| 63 // otherwise looks under the HKCU. | 66 // otherwise looks under the HKCU. |
| 64 static void GetCriticalUpdateVersion(BrowserDistribution* dist, | 67 static void GetCriticalUpdateVersion(BrowserDistribution* dist, |
| 65 bool system_install, | 68 bool system_install, |
| 66 Version* version); | 69 base::Version* version); |
| 67 | 70 |
| 68 // This function checks if the current OS is supported for Chromium. | 71 // This function checks if the current OS is supported for Chromium. |
| 69 static bool IsOSSupported(); | 72 static bool IsOSSupported(); |
| 70 | 73 |
| 71 // Adds work items to |install_list|, which should be a | 74 // Adds work items to |install_list|, which should be a |
| 72 // NoRollbackWorkItemList, to set installer error information in the registry | 75 // NoRollbackWorkItemList, to set installer error information in the registry |
| 73 // for consumption by Google Update. |state_key| must be the full path to an | 76 // for consumption by Google Update. |state_key| must be the full path to an |
| 74 // app's ClientState key. See InstallerState::WriteInstallerResult for more | 77 // app's ClientState key. See InstallerState::WriteInstallerResult for more |
| 75 // details. | 78 // details. |
| 76 static void AddInstallerResultItems(bool system_install, | 79 static void AddInstallerResultItems(bool system_install, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 private: | 202 private: |
| 200 DISALLOW_COPY_AND_ASSIGN(ProgramCompare); | 203 DISALLOW_COPY_AND_ASSIGN(ProgramCompare); |
| 201 }; // class ProgramCompare | 204 }; // class ProgramCompare |
| 202 | 205 |
| 203 private: | 206 private: |
| 204 DISALLOW_COPY_AND_ASSIGN(InstallUtil); | 207 DISALLOW_COPY_AND_ASSIGN(InstallUtil); |
| 205 }; | 208 }; |
| 206 | 209 |
| 207 | 210 |
| 208 #endif // CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ | 211 #endif // CHROME_INSTALLER_UTIL_INSTALL_UTIL_H_ |
| OLD | NEW |