summaryrefslogtreecommitdiffstats
path: root/components/component_updater/default_component_installer.cc
diff options
context:
space:
mode:
authorbauerb <bauerb@chromium.org>2015-02-27 09:27:43 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-27 17:28:15 +0000
commita62abf7bad8d3d50d9c433ac97f1eeca7b9dfcfc (patch)
tree370fba225fa40a40fc7a726e2eba8e983b0abf34 /components/component_updater/default_component_installer.cc
parentd49594b5595a26fd0cb5e30a3e0255e74f31a5f5 (diff)
downloadchromium_src-a62abf7bad8d3d50d9c433ac97f1eeca7b9dfcfc.zip
chromium_src-a62abf7bad8d3d50d9c433ac97f1eeca7b9dfcfc.tar.gz
chromium_src-a62abf7bad8d3d50d9c433ac97f1eeca7b9dfcfc.tar.bz2
Reland r318372: 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 Review URL: https://codereview.chromium.org/962993002 Cr-Commit-Position: refs/heads/master@{#318474}
Diffstat (limited to 'components/component_updater/default_component_installer.cc')
-rw-r--r--components/component_updater/default_component_installer.cc21
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_)