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/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 289 } |
290 | 290 |
291 void RegisterChromeOnMachine(const std::wstring& install_path, | 291 void RegisterChromeOnMachine(const std::wstring& install_path, |
292 bool system_level, | 292 bool system_level, |
293 bool make_chrome_default) { | 293 bool make_chrome_default) { |
294 // Try to add Chrome to Media Player shim inclusion list. We don't do any | 294 // Try to add Chrome to Media Player shim inclusion list. We don't do any |
295 // error checking here because this operation will fail if user doesn't | 295 // error checking here because this operation will fail if user doesn't |
296 // have admin rights and we want to ignore the error. | 296 // have admin rights and we want to ignore the error. |
297 AddChromeToMediaPlayerList(); | 297 AddChromeToMediaPlayerList(); |
298 | 298 |
299 // We try to register Chrome as a valid browser on local machine. This | 299 // Is --make-chrome-default option is given we make Chrome default browser |
300 // will work only if current user has admin rights. | 300 // otherwise we only register it on the machine as a valid browser. |
301 std::wstring chrome_exe(install_path); | 301 std::wstring chrome_exe(install_path); |
302 file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); | 302 file_util::AppendToPath(&chrome_exe, installer_util::kChromeExe); |
303 LOG(INFO) << "Registering Chrome as browser"; | 303 LOG(INFO) << "Registering Chrome as browser"; |
304 if (make_chrome_default) { | 304 if (make_chrome_default) { |
305 ret = ShellUtil::AddChromeToSetAccessDefaults(chrome_exe, false); | 305 int level = ShellUtil::CURRENT_USER; |
306 if (ret == ShellUtil::SUCCESS) { | 306 if (system_level) |
307 if (system_level) { | 307 level = level | ShellUtil::SYSTEM_LEVEL; |
308 ShellUtil::MakeChromeDefault( | 308 ShellUtil::MakeChromeDefault(level, chrome_exe, true); |
309 ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL, chrome_exe); | |
310 } else { | |
311 ShellUtil::MakeChromeDefault(ShellUtil::CURRENT_USER, chrome_exe); | |
312 } | |
313 } | |
314 } else { | 309 } else { |
315 ret = ShellUtil::AddChromeToSetAccessDefaults(chrome_exe, true); | 310 ShellUtil::RegisterChromeBrowser(chrome_exe, L"", false); |
316 } | 311 } |
317 LOG(INFO) << "Return status of Chrome browser registration " << ret; | |
318 } | 312 } |
319 } // namespace | 313 } // namespace |
320 | 314 |
321 bool installer::InstallNewVersion(const std::wstring& exe_path, | 315 bool installer::InstallNewVersion(const std::wstring& exe_path, |
322 const std::wstring& archive_path, | 316 const std::wstring& archive_path, |
323 const std::wstring& src_path, | 317 const std::wstring& src_path, |
324 const std::wstring& install_path, | 318 const std::wstring& install_path, |
325 const std::wstring& temp_dir, | 319 const std::wstring& temp_dir, |
326 const HKEY reg_root, | 320 const HKEY reg_root, |
327 const Version& new_version) { | 321 const Version& new_version) { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 } | 560 } |
567 | 561 |
568 std::wstring installer::GetInstallerPathUnderChrome( | 562 std::wstring installer::GetInstallerPathUnderChrome( |
569 const std::wstring& install_path, const std::wstring& new_version) { | 563 const std::wstring& install_path, const std::wstring& new_version) { |
570 std::wstring installer_path(install_path); | 564 std::wstring installer_path(install_path); |
571 file_util::AppendToPath(&installer_path, new_version); | 565 file_util::AppendToPath(&installer_path, new_version); |
572 file_util::AppendToPath(&installer_path, installer_util::kInstallerDir); | 566 file_util::AppendToPath(&installer_path, installer_util::kInstallerDir); |
573 return installer_path; | 567 return installer_path; |
574 } | 568 } |
575 | 569 |
OLD | NEW |