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 "chrome/installer/util/util_constants.h" | 18 #include "chrome/installer/util/util_constants.h" |
19 #include "chrome/installer/util/version.h" | 19 #include "chrome/installer/util/version.h" |
20 | 20 |
21 class WorkItemList; | 21 class WorkItemList; |
| 22 |
| 23 namespace base { |
| 24 namespace win { |
22 class RegKey; | 25 class RegKey; |
| 26 } // namespace win |
| 27 } // namespace base |
23 | 28 |
24 // This is a utility class that provides common installation related | 29 // This is a utility class that provides common installation related |
25 // 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 |
26 // independently. | 31 // independently. |
27 class InstallUtil { | 32 class InstallUtil { |
28 public: | 33 public: |
29 // Launches given exe as admin on Vista. | 34 // Launches given exe as admin on Vista. |
30 static bool ExecuteExeAsAdmin(const std::wstring& exe, | 35 static bool ExecuteExeAsAdmin(const std::wstring& exe, |
31 const std::wstring& params, | 36 const std::wstring& params, |
32 DWORD* exit_code); | 37 DWORD* exit_code); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // Returns true if at least one DLL was successfully added to | 103 // Returns true if at least one DLL was successfully added to |
99 // registration_list. | 104 // registration_list. |
100 static bool BuildDLLRegistrationList(const std::wstring& install_path, | 105 static bool BuildDLLRegistrationList(const std::wstring& install_path, |
101 const wchar_t** const dll_names, | 106 const wchar_t** const dll_names, |
102 int dll_names_count, | 107 int dll_names_count, |
103 bool do_register, | 108 bool do_register, |
104 bool user_level_registration, | 109 bool user_level_registration, |
105 WorkItemList* registration_list); | 110 WorkItemList* registration_list); |
106 | 111 |
107 // Deletes the registry key at path key_path under the key given by root_key. | 112 // Deletes the registry key at path key_path under the key given by root_key. |
108 static bool DeleteRegistryKey(RegKey& root_key, const std::wstring& key_path); | 113 static bool DeleteRegistryKey(base::win::RegKey& root_key, |
| 114 const std::wstring& key_path); |
109 | 115 |
110 // Deletes the registry value named value_name at path key_path under the key | 116 // Deletes the registry value named value_name at path key_path under the key |
111 // given by reg_root. | 117 // given by reg_root. |
112 static bool DeleteRegistryValue(HKEY reg_root, const std::wstring& key_path, | 118 static bool DeleteRegistryValue(HKEY reg_root, const std::wstring& key_path, |
113 const std::wstring& value_name); | 119 const std::wstring& value_name); |
114 | 120 |
115 private: | 121 private: |
116 DISALLOW_COPY_AND_ASSIGN(InstallUtil); | 122 DISALLOW_COPY_AND_ASSIGN(InstallUtil); |
117 }; | 123 }; |
118 | 124 |
119 | 125 |
120 #endif // CHROME_INSTALLER_UTIL_INSTALL_UTIL_H__ | 126 #endif // CHROME_INSTALLER_UTIL_INSTALL_UTIL_H__ |
OLD | NEW |