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

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

Issue 42003002: Extract supported codecs from CDM component manifest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review feedback 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/component_unpacker.cc
diff --git a/chrome/browser/component_updater/component_unpacker.cc b/chrome/browser/component_updater/component_unpacker.cc
index d47bce829a048ff323c66ac0f61170f67720468a..cf583a08d18541f23ff1d4c30289d203dcacc897 100644
--- a/chrome/browser/component_updater/component_unpacker.cc
+++ b/chrome/browser/component_updater/component_unpacker.cc
@@ -12,6 +12,7 @@
#include "base/memory/scoped_handle.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
+#include "base/values.h"
#include "chrome/browser/component_updater/component_patcher.h"
#include "chrome/browser/component_updater/component_updater_service.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -85,27 +86,32 @@ class CRXValidator {
std::vector<uint8> public_key_;
};
-// Deserialize the CRX manifest. The top level must be a dictionary.
+} // namespace.
+
// TODO(cpu): add a specific attribute check to a component json that the
// extension unpacker will reject, so that a component cannot be installed
// as an extension.
-base::DictionaryValue* ReadManifest(const base::FilePath& unpack_path) {
+scoped_ptr<base::DictionaryValue> ReadManifest(
ddorwin 2013/10/25 19:03:40 I put this function back where it was, so you may
+ const base::FilePath& unpack_path) {
base::FilePath manifest =
unpack_path.Append(FILE_PATH_LITERAL("manifest.json"));
if (!base::PathExists(manifest))
- return NULL;
+ return scoped_ptr<base::DictionaryValue>();
JSONFileValueSerializer serializer(manifest);
std::string error;
scoped_ptr<base::Value> root(serializer.Deserialize(NULL, &error));
- if (!root.get())
- return NULL;
- if (!root->IsType(base::Value::TYPE_DICTIONARY))
- return NULL;
- return static_cast<base::DictionaryValue*>(root.release());
+ if (!root.get()) {
+ DLOG(ERROR) << "Failed to deserialize " << manifest.MaybeAsASCII() << ": "
cpu_(ooo_6.6-7.5) 2013/10/25 23:06:23 please remove the DLOG
ddorwin 2013/10/25 23:27:27 I removed it in the interest of time, but I'd like
+ << error;
+ return scoped_ptr<base::DictionaryValue>();
+ }
+ if (!root->IsType(base::Value::TYPE_DICTIONARY)) {
+ return scoped_ptr<base::DictionaryValue>();
+ }
+ return scoped_ptr<base::DictionaryValue>(
cpu_(ooo_6.6-7.5) 2013/10/25 23:06:23 With more pointer safety comes great verbosity. No
+ static_cast<base::DictionaryValue*>(root.release())).Pass();
}
-} // namespace.
-
ComponentUnpacker::ComponentUnpacker(const std::vector<uint8>& pk_hash,
const base::FilePath& path,
const std::string& fingerprint,
« no previous file with comments | « chrome/browser/component_updater/component_unpacker.h ('k') | chrome/browser/component_updater/default_component_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698