OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 11 #pragma once |
12 | 12 |
13 #include <tchar.h> | 13 #include <tchar.h> |
14 #include <windows.h> | 14 #include <windows.h> |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
| 18 #include "base/command_line.h" |
18 #include "chrome/installer/util/master_preferences.h" | 19 #include "chrome/installer/util/master_preferences.h" |
19 #include "chrome/installer/util/util_constants.h" | 20 #include "chrome/installer/util/util_constants.h" |
20 #include "chrome/installer/util/version.h" | 21 #include "chrome/installer/util/version.h" |
21 | 22 |
22 class WorkItemList; | 23 class WorkItemList; |
23 | 24 |
24 namespace base { | 25 namespace base { |
25 namespace win { | 26 namespace win { |
26 class RegKey; | 27 class RegKey; |
27 } // namespace win | 28 } // namespace win |
28 } // namespace base | 29 } // namespace base |
29 | 30 |
30 // This is a utility class that provides common installation related | 31 // This is a utility class that provides common installation related |
31 // utility methods that can be used by installer and also unit tested | 32 // utility methods that can be used by installer and also unit tested |
32 // independently. | 33 // independently. |
33 class InstallUtil { | 34 class InstallUtil { |
34 public: | 35 public: |
35 // Launches given exe as admin on Vista. | 36 // Launches given exe as admin on Vista. |
36 static bool ExecuteExeAsAdmin(const std::wstring& exe, | 37 static bool ExecuteExeAsAdmin(const CommandLine& cmd, DWORD* exit_code); |
37 const std::wstring& params, | |
38 DWORD* exit_code); | |
39 | 38 |
40 // Reads the uninstall command for Chromium from registry and returns it. | 39 // Reads the uninstall command for Chromium from registry and returns it. |
41 // If system_install is true the command is read from HKLM, otherwise | 40 // If system_install is true the command is read from HKLM, otherwise |
42 // from HKCU. | 41 // from HKCU. |
43 static std::wstring GetChromeUninstallCmd(bool system_install); | 42 static std::wstring GetChromeUninstallCmd(bool system_install); |
44 // Find the version of Chrome installed on the system by checking the | 43 // Find the version of Chrome installed on the system by checking the |
45 // Google Update registry key. Returns the version or NULL if no version is | 44 // Google Update registry key. Returns the version or NULL if no version is |
46 // found. | 45 // found. |
47 // system_install: if true, looks for version number under the HKLM root, | 46 // system_install: if true, looks for version number under the HKLM root, |
48 // otherwise looks under the HKCU. | 47 // otherwise looks under the HKCU. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // NOTE: Must not be called before CommandLine::Init() is called! | 123 // NOTE: Must not be called before CommandLine::Init() is called! |
125 static const installer_util::MasterPreferences& | 124 static const installer_util::MasterPreferences& |
126 GetMasterPreferencesForCurrentProcess(); | 125 GetMasterPreferencesForCurrentProcess(); |
127 | 126 |
128 private: | 127 private: |
129 DISALLOW_COPY_AND_ASSIGN(InstallUtil); | 128 DISALLOW_COPY_AND_ASSIGN(InstallUtil); |
130 }; | 129 }; |
131 | 130 |
132 | 131 |
133 #endif // CHROME_INSTALLER_UTIL_INSTALL_UTIL_H__ | 132 #endif // CHROME_INSTALLER_UTIL_INSTALL_UTIL_H__ |
OLD | NEW |