| 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/component_updater/recovery_component_installer.h" | 5 #include "chrome/browser/component_updater/recovery_component_installer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 base::FilePath* installed_file) { | 486 base::FilePath* installed_file) { |
| 487 return false; | 487 return false; |
| 488 } | 488 } |
| 489 | 489 |
| 490 bool RecoveryComponentInstaller::Uninstall() { | 490 bool RecoveryComponentInstaller::Uninstall() { |
| 491 return false; | 491 return false; |
| 492 } | 492 } |
| 493 | 493 |
| 494 void RegisterRecoveryComponent(ComponentUpdateService* cus, | 494 void RegisterRecoveryComponent(ComponentUpdateService* cus, |
| 495 PrefService* prefs) { | 495 PrefService* prefs) { |
| 496 #if defined(GOOGLE_CHROME_BUILD) | 496 #if !defined(OS_CHROMEOS) && defined(GOOGLE_CHROME_BUILD) |
| 497 #if defined(OS_WIN) || defined(OS_MACOSX) | |
| 498 if (SimulatingElevatedRecovery()) { | 497 if (SimulatingElevatedRecovery()) { |
| 499 BrowserThread::PostTask( | 498 BrowserThread::PostTask( |
| 500 BrowserThread::UI, | 499 BrowserThread::UI, |
| 501 FROM_HERE, | 500 FROM_HERE, |
| 502 base::Bind(&SimulateElevatedRecoveryHelper, prefs)); | 501 base::Bind(&SimulateElevatedRecoveryHelper, prefs)); |
| 503 } | 502 } |
| 504 | 503 |
| 505 // We delay execute the registration because we are not required in | 504 // We delay execute the registration because we are not required in |
| 506 // the critical path during browser startup. | 505 // the critical path during browser startup. |
| 507 BrowserThread::PostDelayedTask( | 506 BrowserThread::PostDelayedTask( |
| 508 BrowserThread::UI, | 507 BrowserThread::UI, |
| 509 FROM_HERE, | 508 FROM_HERE, |
| 510 base::Bind(&RecoveryRegisterHelper, cus, prefs), | 509 base::Bind(&RecoveryRegisterHelper, cus, prefs), |
| 511 base::TimeDelta::FromSeconds(6)); | 510 base::TimeDelta::FromSeconds(6)); |
| 512 #endif | 511 #endif // !defined(OS_CHROMEOS) && defined(GOOGLE_CHROME_BUILD) |
| 513 #endif | |
| 514 } | 512 } |
| 515 | 513 |
| 516 void RegisterPrefsForRecoveryComponent(PrefRegistrySimple* registry) { | 514 void RegisterPrefsForRecoveryComponent(PrefRegistrySimple* registry) { |
| 517 registry->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0"); | 515 registry->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0"); |
| 518 registry->RegisterFilePathPref(prefs::kRecoveryComponentUnpackPath, | 516 registry->RegisterFilePathPref(prefs::kRecoveryComponentUnpackPath, |
| 519 base::FilePath()); | 517 base::FilePath()); |
| 520 registry->RegisterBooleanPref(prefs::kRecoveryComponentNeedsElevation, false); | 518 registry->RegisterBooleanPref(prefs::kRecoveryComponentNeedsElevation, false); |
| 521 } | 519 } |
| 522 | 520 |
| 523 void AcceptedElevatedRecoveryInstall(PrefService* prefs) { | 521 void AcceptedElevatedRecoveryInstall(PrefService* prefs) { |
| 524 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 522 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 525 | 523 |
| 526 #if defined(OS_WIN) || defined(OS_MACOSX) | 524 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 527 ElevatedInstallRecoveryComponent( | 525 ElevatedInstallRecoveryComponent( |
| 528 prefs->GetFilePath(prefs::kRecoveryComponentUnpackPath)); | 526 prefs->GetFilePath(prefs::kRecoveryComponentUnpackPath)); |
| 529 #endif // OS_WIN | 527 #endif // OS_WIN |
| 530 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); | 528 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); |
| 531 } | 529 } |
| 532 | 530 |
| 533 void DeclinedElevatedRecoveryInstall(PrefService* prefs) { | 531 void DeclinedElevatedRecoveryInstall(PrefService* prefs) { |
| 534 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 532 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 535 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); | 533 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); |
| 536 } | 534 } |
| 537 | 535 |
| 538 } // namespace component_updater | 536 } // namespace component_updater |
| OLD | NEW |