Chromium Code Reviews| Index: chrome/browser/component_updater/default_component_installer.cc |
| diff --git a/chrome/browser/component_updater/default_component_installer.cc b/chrome/browser/component_updater/default_component_installer.cc |
| index b610f2ee4267616b1299cdcbfa72e935b9e9bb41..f0d1b0fa369b95e7a7be290c2ce4d0360c8d49a4 100644 |
| --- a/chrome/browser/component_updater/default_component_installer.cc |
| +++ b/chrome/browser/component_updater/default_component_installer.cc |
| @@ -17,6 +17,9 @@ namespace { |
| const char kNullVersion[] = "0.0.0.0"; |
| } // namespace |
| +ComponentInstallerTraits::~ComponentInstallerTraits() { |
| +} |
| + |
| DefaultComponentInstaller::DefaultComponentInstaller( |
| scoped_ptr<ComponentInstallerTraits> installer_traits) |
| : current_version_(kNullVersion) { |
| @@ -76,7 +79,11 @@ bool DefaultComponentInstaller::Install(const base::DictionaryValue& manifest, |
| return false; |
| } |
| current_version_ = version; |
| - installer_traits_->ComponentReady(current_version_, GetInstallDirectory()); |
| + current_manifest_.reset(manifest.DeepCopy()); |
| + installer_traits_->ComponentReady( |
| + current_version_, |
| + GetInstallDirectory(), |
| + scoped_ptr<base::DictionaryValue>(current_manifest_->DeepCopy()).Pass()); |
| return true; |
| } |
| @@ -133,8 +140,17 @@ void DefaultComponentInstaller::StartRegistration( |
| if (found) { |
| current_version_ = latest_version; |
| + // TODO(waffles): Why do we save these as members rather than passing them |
| + // to FinishRegistration()? |
|
waffles
2013/10/24 23:07:06
There was the thought that the installer would be
ddorwin
2013/10/25 00:06:05
Okay, I'll change the TODO to be for me to remove
|
| base::ReadFileToString(latest_dir.AppendASCII("manifest.fingerprint"), |
| ¤t_fingerprint_); |
| + current_manifest_.reset(ReadComponentManifest(latest_dir)); |
| + if (!current_manifest_) { |
| + DLOG(ERROR) << "Failed to read manifest for " |
| + << installer_traits_->GetName() << " (" |
| + << base_dir.MaybeAsASCII() << ")."; |
| + return; |
| + } |
| } |
| // Remove older versions of the component. None should be in use during |
| @@ -174,11 +190,17 @@ void DefaultComponentInstaller::FinishRegistration( |
| } |
| if (current_version_.CompareTo(base::Version(kNullVersion)) > 0) { |
| + // TODO(waffles): Why is this function called on the FILE thread? The only |
| + // implementation just posts back to the UI thread. Should we instead post |
| + // to UI in Install()? |
|
waffles
2013/10/24 23:07:06
The thinking was that people would likely want to
ddorwin
2013/10/25 00:06:05
Assuming we're going to pass in the manifest like
waffles
2013/10/25 16:53:42
I'm OK with passing the manifest; it's fine with m
ddorwin
2013/10/25 19:03:40
Updated TODO.
waffles
2013/10/25 19:43:45
They'll call PathService::OverridePath and then so
|
| + scoped_ptr<base::DictionaryValue> manifest_copy( |
| + current_manifest_->DeepCopy()); |
| content::BrowserThread::PostTask( |
| content::BrowserThread::FILE, FROM_HERE, |
| base::Bind(&ComponentInstallerTraits::ComponentReady, |
| base::Unretained(installer_traits_.get()), |
| current_version_, |
| - GetInstallDirectory())); |
| + GetInstallDirectory(), |
| + base::Passed(&manifest_copy))); |
| } |
| } |