diff options
author | bauerb <bauerb@chromium.org> | 2015-02-26 17:29:24 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-27 01:30:24 +0000 |
commit | 9dcd9897bddc7f8b2da43292c72c025a60c58fbc (patch) | |
tree | 941478ef1fd3061f28e93177678654bbb3fad32e /components/component_updater/default_component_installer.cc | |
parent | 6274399b9a1e29985f9604e01e8e7d28c9def596 (diff) | |
download | chromium_src-9dcd9897bddc7f8b2da43292c72c025a60c58fbc.zip chromium_src-9dcd9897bddc7f8b2da43292c72c025a60c58fbc.tar.gz chromium_src-9dcd9897bddc7f8b2da43292c72c025a60c58fbc.tar.bz2 |
Don't check for supervised user whitelist updates until after registering the corresponding component.
Previously, the call to OnDemandUpdate would fail because the component wasn't registered yet, but SupervisedUserWhitelistInstaller didn't check the return value. Now it does, and the unit test checks that OnDemandUpdate isn't called too early.
BUG=436459
Review URL: https://codereview.chromium.org/938053002
Cr-Commit-Position: refs/heads/master@{#318372}
Diffstat (limited to 'components/component_updater/default_component_installer.cc')
-rw-r--r-- | components/component_updater/default_component_installer.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/components/component_updater/default_component_installer.cc b/components/component_updater/default_component_installer.cc index 027b1cb..d430863 100644 --- a/components/component_updater/default_component_installer.cc +++ b/components/component_updater/default_component_installer.cc @@ -44,7 +44,9 @@ DefaultComponentInstaller::DefaultComponentInstaller( DefaultComponentInstaller::~DefaultComponentInstaller() { } -void DefaultComponentInstaller::Register(ComponentUpdateService* cus) { +void DefaultComponentInstaller::Register( + ComponentUpdateService* cus, + const base::Closure& callback) { DCHECK(thread_checker_.CalledOnValidThread()); task_runner_ = cus->GetSequencedTaskRunner(); @@ -53,10 +55,12 @@ void DefaultComponentInstaller::Register(ComponentUpdateService* cus) { << "has no installer traits."; return; } - task_runner_->PostTask( + task_runner_->PostTaskAndReply( FROM_HERE, base::Bind(&DefaultComponentInstaller::StartRegistration, - this, cus)); + this, cus), + base::Bind(&DefaultComponentInstaller::FinishRegistration, + this, cus, callback)); } void DefaultComponentInstaller::OnUpdateError(int error) { @@ -199,11 +203,6 @@ void DefaultComponentInstaller::StartRegistration(ComponentUpdateService* cus) { // browser startup. for (const auto& older_path : older_paths) base::DeleteFile(older_path, true); - - main_task_runner_->PostTask( - FROM_HERE, - base::Bind(&DefaultComponentInstaller::FinishRegistration, - this, cus)); } void DefaultComponentInstaller::UninstallOnTaskRunner() { @@ -239,7 +238,8 @@ base::FilePath DefaultComponentInstaller::GetInstallDirectory() { } void DefaultComponentInstaller::FinishRegistration( - ComponentUpdateService* cus) { + ComponentUpdateService* cus, + const base::Closure& callback) { DCHECK(thread_checker_.CalledOnValidThread()); if (installer_traits_->CanAutoUpdate()) { CrxComponent crx; @@ -255,6 +255,9 @@ void DefaultComponentInstaller::FinishRegistration( << installer_traits_->GetName(); return; } + + if (!callback.is_null()) + callback.Run(); } if (!current_manifest_) |