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 #include "chrome/browser/chrome_browser_main_win.h" | 5 #include "chrome/browser/chrome_browser_main_win.h" |
6 | 6 |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 | 10 |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 | 453 |
454 // Exit as we are not launching the browser. | 454 // Exit as we are not launching the browser. |
455 return content::RESULT_CODE_NORMAL_EXIT; | 455 return content::RESULT_CODE_NORMAL_EXIT; |
456 } | 456 } |
457 // We don't hide icons so we shouldn't do anything special to show them | 457 // We don't hide icons so we shouldn't do anything special to show them |
458 return chrome::RESULT_CODE_UNSUPPORTED_PARAM; | 458 return chrome::RESULT_CODE_UNSUPPORTED_PARAM; |
459 } | 459 } |
460 | 460 |
461 // static | 461 // static |
462 bool ChromeBrowserMainPartsWin::CheckMachineLevelInstall() { | 462 bool ChromeBrowserMainPartsWin::CheckMachineLevelInstall() { |
463 // TODO(tommi): Check if using the default distribution is always the right | |
464 // thing to do. | |
465 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 463 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
466 base::Version version; | 464 base::Version version; |
467 InstallUtil::GetChromeVersion(dist, true, &version); | 465 InstallUtil::GetChromeVersion(dist, true, &version); |
468 if (version.IsValid()) { | 466 if (version.IsValid()) { |
469 base::FilePath exe_path; | 467 base::FilePath exe_path; |
470 PathService::Get(base::DIR_EXE, &exe_path); | 468 PathService::Get(base::DIR_EXE, &exe_path); |
471 std::wstring exe = exe_path.value(); | 469 std::wstring exe = exe_path.value(); |
472 base::FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); | 470 base::FilePath user_exe_path(installer::GetChromeInstallPath(false, dist)); |
473 if (base::FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { | 471 if (base::FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) { |
474 base::CommandLine uninstall_cmd( | 472 base::CommandLine uninstall_cmd( |
475 InstallUtil::GetChromeUninstallCmd(false, dist->GetType())); | 473 InstallUtil::GetChromeUninstallCmd(false)); |
476 if (!uninstall_cmd.GetProgram().empty()) { | 474 if (!uninstall_cmd.GetProgram().empty()) { |
477 uninstall_cmd.AppendSwitch(installer::switches::kSelfDestruct); | 475 uninstall_cmd.AppendSwitch(installer::switches::kSelfDestruct); |
478 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); | 476 uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); |
479 uninstall_cmd.AppendSwitch( | 477 uninstall_cmd.AppendSwitch( |
480 installer::switches::kDoNotRemoveSharedItems); | 478 installer::switches::kDoNotRemoveSharedItems); |
481 | 479 |
482 // Trigger Active Setup for the system-level Chrome to make sure | 480 // Trigger Active Setup for the system-level Chrome to make sure |
483 // per-user shortcuts to the system-level Chrome are created. Skip this | 481 // per-user shortcuts to the system-level Chrome are created. Skip this |
484 // if the system-level Chrome will undergo first run anyway, as Active | 482 // if the system-level Chrome will undergo first run anyway, as Active |
485 // Setup is triggered on system-level Chrome's first run. | 483 // Setup is triggered on system-level Chrome's first run. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 if (resource_id) | 523 if (resource_id) |
526 return l10n_util::GetStringUTF16(resource_id); | 524 return l10n_util::GetStringUTF16(resource_id); |
527 return base::string16(); | 525 return base::string16(); |
528 } | 526 } |
529 | 527 |
530 // static | 528 // static |
531 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { | 529 void ChromeBrowserMainPartsWin::SetupInstallerUtilStrings() { |
532 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); | 530 CR_DEFINE_STATIC_LOCAL(TranslationDelegate, delegate, ()); |
533 installer::SetTranslationDelegate(&delegate); | 531 installer::SetTranslationDelegate(&delegate); |
534 } | 532 } |
OLD | NEW |