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 // See the corresponding header file for description of the functions in this | 5 // See the corresponding header file for description of the functions in this |
6 // file. | 6 // file. |
7 | 7 |
8 #include "chrome/installer/util/install_util.h" | 8 #include "chrome/installer/util/install_util.h" |
9 | 9 |
10 #include <shellapi.h> | 10 #include <shellapi.h> |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 if (uac_foreground_window) { | 160 if (uac_foreground_window) { |
161 DestroyWindow(uac_foreground_window); | 161 DestroyWindow(uac_foreground_window); |
162 } | 162 } |
163 | 163 |
164 return success; | 164 return success; |
165 } | 165 } |
166 | 166 |
167 base::CommandLine InstallUtil::GetChromeUninstallCmd( | 167 base::CommandLine InstallUtil::GetChromeUninstallCmd(bool system_install) { |
168 bool system_install, | |
169 BrowserDistribution::Type distribution_type) { | |
170 ProductState state; | 168 ProductState state; |
171 if (state.Initialize(system_install, distribution_type)) { | 169 if (state.Initialize(system_install)) |
172 return state.uninstall_command(); | 170 return state.uninstall_command(); |
173 } | |
174 return base::CommandLine(base::CommandLine::NO_PROGRAM); | 171 return base::CommandLine(base::CommandLine::NO_PROGRAM); |
175 } | 172 } |
176 | 173 |
177 void InstallUtil::GetChromeVersion(BrowserDistribution* dist, | 174 void InstallUtil::GetChromeVersion(BrowserDistribution* dist, |
178 bool system_install, | 175 bool system_install, |
179 base::Version* version) { | 176 base::Version* version) { |
180 DCHECK(dist); | 177 DCHECK(dist); |
181 RegKey key; | 178 RegKey key; |
182 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 179 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
183 LONG result = key.Open(reg_root, | 180 LONG result = key.Open(reg_root, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 program_files_path.value().data(), prefix_len) != | 314 program_files_path.value().data(), prefix_len) != |
318 CSTR_EQUAL; | 315 CSTR_EQUAL; |
319 } | 316 } |
320 | 317 |
321 void InstallUtil::ResetIsPerUserInstallForTest() { | 318 void InstallUtil::ResetIsPerUserInstallForTest() { |
322 std::unique_ptr<base::Environment> env(base::Environment::Create()); | 319 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
323 env->UnSetVar(kEnvProgramFilesPath); | 320 env->UnSetVar(kEnvProgramFilesPath); |
324 } | 321 } |
325 | 322 |
326 bool InstallUtil::IsMultiInstall(bool system_install) { | 323 bool InstallUtil::IsMultiInstall(bool system_install) { |
327 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | |
328 ProductState state; | 324 ProductState state; |
329 return state.Initialize(system_install, dist) && state.is_multi_install(); | 325 return state.Initialize(system_install) && state.is_multi_install(); |
330 } | 326 } |
331 | 327 |
332 bool CheckIsChromeSxSProcess() { | 328 bool CheckIsChromeSxSProcess() { |
333 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 329 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
334 CHECK(command_line); | 330 CHECK(command_line); |
335 | 331 |
336 if (command_line->HasSwitch(installer::switches::kChromeSxS)) | 332 if (command_line->HasSwitch(installer::switches::kChromeSxS)) |
337 return true; | 333 return true; |
338 | 334 |
339 // Also return true if we are running from Chrome SxS installed path. | 335 // Also return true if we are running from Chrome SxS installed path. |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 // Open the program and see if it references the expected file. | 629 // Open the program and see if it references the expected file. |
634 base::File file; | 630 base::File file; |
635 BY_HANDLE_FILE_INFORMATION info = {}; | 631 BY_HANDLE_FILE_INFORMATION info = {}; |
636 | 632 |
637 return (OpenForInfo(path, &file) && | 633 return (OpenForInfo(path, &file) && |
638 GetInfo(file, &info) && | 634 GetInfo(file, &info) && |
639 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 635 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
640 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 636 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
641 info.nFileIndexLow == file_info_.nFileIndexLow); | 637 info.nFileIndexLow == file_info_.nFileIndexLow); |
642 } | 638 } |
OLD | NEW |