Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4471)

Unified Diff: chrome/browser/component_updater/default_component_installer.cc

Issue 42003002: Extract supported codecs from CDM component manifest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added includes; removed DLOG Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..71f7d5d2c1c44f7fd172c91020857263628bc490 100644
--- a/chrome/browser/component_updater/default_component_installer.cc
+++ b/chrome/browser/component_updater/default_component_installer.cc
@@ -8,6 +8,8 @@
#include "base/files/file_path.h"
#include "base/values.h"
#include "base/version.h"
+// TODO(ddorwin): Find a better place for ReadManifest.
+#include "chrome/browser/component_updater/component_unpacker.h"
#include "chrome/browser/component_updater/default_component_installer.h"
#include "content/public/browser/browser_thread.h"
@@ -17,6 +19,9 @@ namespace {
const char kNullVersion[] = "0.0.0.0";
} // namespace
+ComponentInstallerTraits::~ComponentInstallerTraits() {
+}
+
DefaultComponentInstaller::DefaultComponentInstaller(
scoped_ptr<ComponentInstallerTraits> installer_traits)
: current_version_(kNullVersion) {
@@ -76,7 +81,13 @@ bool DefaultComponentInstaller::Install(const base::DictionaryValue& manifest,
return false;
}
current_version_ = version;
- installer_traits_->ComponentReady(current_version_, GetInstallDirectory());
+ // TODO(ddorwin): Change the parameter to scoped_ptr<base::DictionaryValue>
+ // so we can avoid this DeepCopy.
+ current_manifest_.reset(manifest.DeepCopy());
+ installer_traits_->ComponentReady(
+ current_version_,
+ GetInstallDirectory(),
+ scoped_ptr<base::DictionaryValue>(current_manifest_->DeepCopy()).Pass());
return true;
}
@@ -133,8 +144,17 @@ void DefaultComponentInstaller::StartRegistration(
if (found) {
current_version_ = latest_version;
+ // TODO(ddorwin): Remove these members and pass them directly to
+ // FinishRegistration().
base::ReadFileToString(latest_dir.AppendASCII("manifest.fingerprint"),
&current_fingerprint_);
+ current_manifest_= ReadManifest(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 +194,16 @@ void DefaultComponentInstaller::FinishRegistration(
}
if (current_version_.CompareTo(base::Version(kNullVersion)) > 0) {
+ // TODO(ddorwin): Call this function directly the UI thread. The only
+ // implementation posts back to the UI thread. Then post to UI in Install().
+ 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)));
}
}

Powered by Google App Engine
This is Rietveld 408576698