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 #include <shlobj.h> | 5 #include <shlobj.h> |
6 #include <time.h> | 6 #include <time.h> |
7 | 7 |
8 #include "chrome/installer/setup/install.h" | 8 #include "chrome/installer/setup/install.h" |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 return false; | 279 return false; |
280 } | 280 } |
281 | 281 |
282 void RegisterChromeOnMachine(const std::wstring& install_path, int options) { | 282 void RegisterChromeOnMachine(const std::wstring& install_path, int options) { |
283 bool system_level = (options & installer_util::SYSTEM_LEVEL) != 0; | 283 bool system_level = (options & installer_util::SYSTEM_LEVEL) != 0; |
284 // Try to add Chrome to Media Player shim inclusion list. We don't do any | 284 // Try to add Chrome to Media Player shim inclusion list. We don't do any |
285 // error checking here because this operation will fail if user doesn't | 285 // error checking here because this operation will fail if user doesn't |
286 // have admin rights and we want to ignore the error. | 286 // have admin rights and we want to ignore the error. |
287 AddChromeToMediaPlayerList(); | 287 AddChromeToMediaPlayerList(); |
288 | 288 |
289 // We try to register Chrome as a valid browser on local machine. This | 289 // Is --make-chrome-default option is given we make Chrome default browser |
290 // will work only if current user has admin rights. | 290 // otherwise we only register it on the machine as a valid browser. |
291 std::wstring chrome_exe(install_path); | 291 std::wstring chrome_exe(install_path); |
292 file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); | 292 file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); |
293 LOG(INFO) << "Registering Chrome as browser"; | 293 LOG(INFO) << "Registering Chrome as browser"; |
294 ShellUtil::RegisterStatus ret = ShellUtil::FAILURE; | |
295 if (options & installer_util::MAKE_CHROME_DEFAULT) { | 294 if (options & installer_util::MAKE_CHROME_DEFAULT) { |
296 ret = ShellUtil::AddChromeToSetAccessDefaults(chrome_exe, false); | 295 int level = ShellUtil::CURRENT_USER; |
297 if (ret == ShellUtil::SUCCESS) { | 296 if (system_level) |
298 if (system_level) { | 297 level = level | ShellUtil::SYSTEM_LEVEL; |
299 ShellUtil::MakeChromeDefault( | 298 ShellUtil::MakeChromeDefault(level, chrome_exe, true); |
300 ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL, chrome_exe); | |
301 } else { | |
302 ShellUtil::MakeChromeDefault(ShellUtil::CURRENT_USER, chrome_exe); | |
303 } | |
304 } | |
305 } else { | 299 } else { |
306 ret = ShellUtil::AddChromeToSetAccessDefaults(chrome_exe, true); | 300 ShellUtil::RegisterChromeBrowser(chrome_exe, L"", false); |
307 } | 301 } |
308 LOG(INFO) << "Return status of Chrome browser registration " << ret; | |
309 } | 302 } |
310 } // namespace | 303 } // namespace |
311 | 304 |
312 bool installer::InstallNewVersion(const std::wstring& exe_path, | 305 bool installer::InstallNewVersion(const std::wstring& exe_path, |
313 const std::wstring& archive_path, | 306 const std::wstring& archive_path, |
314 const std::wstring& src_path, | 307 const std::wstring& src_path, |
315 const std::wstring& install_path, | 308 const std::wstring& install_path, |
316 const std::wstring& temp_dir, | 309 const std::wstring& temp_dir, |
317 const HKEY reg_root, | 310 const HKEY reg_root, |
318 const Version& new_version) { | 311 const Version& new_version) { |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 539 } |
547 | 540 |
548 std::wstring installer::GetInstallerPathUnderChrome( | 541 std::wstring installer::GetInstallerPathUnderChrome( |
549 const std::wstring& install_path, const std::wstring& new_version) { | 542 const std::wstring& install_path, const std::wstring& new_version) { |
550 std::wstring installer_path(install_path); | 543 std::wstring installer_path(install_path); |
551 file_util::AppendToPath(&installer_path, new_version); | 544 file_util::AppendToPath(&installer_path, new_version); |
552 file_util::AppendToPath(&installer_path, installer_util::kInstallerDir); | 545 file_util::AppendToPath(&installer_path, installer_util::kInstallerDir); |
553 return installer_path; | 546 return installer_path; |
554 } | 547 } |
555 | 548 |
OLD | NEW |