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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(FilePath::FromWStringHack(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 = CommandLine::FromString(exe_path); |
305 command_line.ParseFromString(exe_path); | |
306 exe_path = command_line.program(); | 305 exe_path = command_line.program(); |
307 } | 306 } |
308 if (file_util::PathExists(FilePath::FromWStringHack(exe_path))) { | 307 if (file_util::PathExists(FilePath::FromWStringHack(exe_path))) { |
309 std::wstring params(L"--"); | 308 std::wstring params(L"--"); |
310 params.append(installer_util::switches::kRegisterChromeBrowser); | 309 params.append(installer_util::switches::kRegisterChromeBrowser); |
311 params.append(L"=\"" + chrome_exe + L"\""); | 310 params.append(L"=\"" + chrome_exe + L"\""); |
312 if (!suffix.empty()) { | 311 if (!suffix.empty()) { |
313 params.append(L" --"); | 312 params.append(L" --"); |
314 params.append(installer_util::switches::kRegisterChromeBrowserSuffix); | 313 params.append(installer_util::switches::kRegisterChromeBrowserSuffix); |
315 params.append(L"=\"" + suffix + L"\""); | 314 params.append(L"=\"" + suffix + L"\""); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 } else { | 771 } else { |
773 return file_util::UpdateShortcutLink(chrome_exe.c_str(), // target | 772 return file_util::UpdateShortcutLink(chrome_exe.c_str(), // target |
774 shortcut.c_str(), // shortcut | 773 shortcut.c_str(), // shortcut |
775 chrome_path.c_str(), // working dir | 774 chrome_path.c_str(), // working dir |
776 NULL, // arguments | 775 NULL, // arguments |
777 description.c_str(), // description | 776 description.c_str(), // description |
778 chrome_exe.c_str(), // icon file | 777 chrome_exe.c_str(), // icon file |
779 0); // icon index | 778 0); // icon index |
780 } | 779 } |
781 } | 780 } |
OLD | NEW |