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

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: Use constant; support existing manifests 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..613ec7f839cf658671ef431e1950ac184b400d23 100644
--- a/chrome/browser/component_updater/component_unpacker.cc
+++ b/chrome/browser/component_updater/component_unpacker.cc
@@ -8,10 +8,10 @@
#include <vector>
#include "base/file_util.h"
-#include "base/json/json_file_value_serializer.h"
#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,25 +85,6 @@ class CRXValidator {
std::vector<uint8> public_key_;
};
-// Deserialize the CRX manifest. The top level must be a dictionary.
-// 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) {
- base::FilePath manifest =
- unpack_path.Append(FILE_PATH_LITERAL("manifest.json"));
- if (!base::PathExists(manifest))
- return NULL;
- 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());
-}
-
} // namespace.
ComponentUnpacker::ComponentUnpacker(const std::vector<uint8>& pk_hash,
@@ -179,7 +160,8 @@ ComponentUnpacker::ComponentUnpacker(const std::vector<uint8>& pk_hash,
return;
}
}
- scoped_ptr<base::DictionaryValue> manifest(ReadManifest(unpack_path_));
+ scoped_ptr<base::DictionaryValue> manifest(
+ ReadComponentManifest(unpack_path_));
if (!manifest.get()) {
error_ = kBadManifest;
return;

Powered by Google App Engine
This is Rietveld 408576698