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