OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 defines functions that integrate Chrome in Windows shell. These | 5 // This file defines functions that integrate Chrome in Windows shell. These |
6 // functions can be used by Chrome as well as Chrome installer. All of the | 6 // functions can be used by Chrome as well as Chrome installer. All of the |
7 // work is done by the local functions defined in anonymous namespace in | 7 // work is done by the local functions defined in anonymous namespace in |
8 // this class. | 8 // this class. |
9 | 9 |
10 #include "chrome/installer/util/shell_util.h" | 10 #include "chrome/installer/util/shell_util.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } | 288 } |
289 | 289 |
290 // This method registers Chrome on Vista by launching eleavated setup.exe. | 290 // This method registers Chrome on Vista by launching eleavated setup.exe. |
291 // That will show user standard Vista elevation prompt. If user accepts it | 291 // That will show user standard Vista elevation prompt. If user accepts it |
292 // the new process will make the necessary changes and return SUCCESS that | 292 // the new process will make the necessary changes and return SUCCESS that |
293 // we capture and return. | 293 // we capture and return. |
294 bool ElevateAndRegisterChrome(const std::wstring& chrome_exe, | 294 bool ElevateAndRegisterChrome(const std::wstring& chrome_exe, |
295 const std::wstring& suffix) { | 295 const std::wstring& suffix) { |
296 std::wstring exe_path(file_util::GetDirectoryFromPath(chrome_exe)); | 296 std::wstring exe_path(file_util::GetDirectoryFromPath(chrome_exe)); |
297 file_util::AppendToPath(&exe_path, installer_util::kSetupExe); | 297 file_util::AppendToPath(&exe_path, installer_util::kSetupExe); |
298 if (!file_util::PathExists(exe_path)) { | 298 if (!file_util::PathExists(FilePath::FromWStringHack(exe_path))) { |
299 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 299 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
300 HKEY reg_root = InstallUtil::IsPerUserInstall(chrome_exe.c_str()) ? | 300 HKEY reg_root = InstallUtil::IsPerUserInstall(chrome_exe.c_str()) ? |
301 HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; | 301 HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; |
302 RegKey key(reg_root, dist->GetUninstallRegPath().c_str()); | 302 RegKey key(reg_root, dist->GetUninstallRegPath().c_str()); |
303 key.ReadValue(installer_util::kUninstallStringField, &exe_path); | 303 key.ReadValue(installer_util::kUninstallStringField, &exe_path); |
304 CommandLine command_line(L""); | 304 CommandLine command_line(L""); |
305 command_line.ParseFromString(exe_path); | 305 command_line.ParseFromString(exe_path); |
306 exe_path = command_line.program(); | 306 exe_path = command_line.program(); |
307 } | 307 } |
308 if (file_util::PathExists(exe_path)) { | 308 if (file_util::PathExists(FilePath::FromWStringHack(exe_path))) { |
309 std::wstring params(L"--"); | 309 std::wstring params(L"--"); |
310 params.append(installer_util::switches::kRegisterChromeBrowser); | 310 params.append(installer_util::switches::kRegisterChromeBrowser); |
311 params.append(L"=\"" + chrome_exe + L"\""); | 311 params.append(L"=\"" + chrome_exe + L"\""); |
312 if (!suffix.empty()) { | 312 if (!suffix.empty()) { |
313 params.append(L" --"); | 313 params.append(L" --"); |
314 params.append(installer_util::switches::kRegisterChromeBrowserSuffix); | 314 params.append(installer_util::switches::kRegisterChromeBrowserSuffix); |
315 params.append(L"=\"" + suffix + L"\""); | 315 params.append(L"=\"" + suffix + L"\""); |
316 } | 316 } |
317 DWORD ret_val = 0; | 317 DWORD ret_val = 0; |
318 InstallUtil::ExecuteExeAsAdmin(exe_path, params, &ret_val); | 318 InstallUtil::ExecuteExeAsAdmin(exe_path, params, &ret_val); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 } else { | 772 } else { |
773 return file_util::UpdateShortcutLink(chrome_exe.c_str(), // target | 773 return file_util::UpdateShortcutLink(chrome_exe.c_str(), // target |
774 shortcut.c_str(), // shortcut | 774 shortcut.c_str(), // shortcut |
775 chrome_path.c_str(), // working dir | 775 chrome_path.c_str(), // working dir |
776 NULL, // arguments | 776 NULL, // arguments |
777 description.c_str(), // description | 777 description.c_str(), // description |
778 chrome_exe.c_str(), // icon file | 778 chrome_exe.c_str(), // icon file |
779 0); // icon index | 779 0); // icon index |
780 } | 780 } |
781 } | 781 } |
OLD | NEW |