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

Unified Diff: chrome/browser/component_updater/component_updater_service.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_updater_service.cc
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc
index a4829d213a2f7abf5667e559a23c5b8d532f6e6d..fde65ef2b7abc62fcd420494c9d1c6432536d3cc 100644
--- a/chrome/browser/component_updater/component_updater_service.cc
+++ b/chrome/browser/component_updater/component_updater_service.cc
@@ -13,6 +13,7 @@
#include "base/compiler_specific.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/json/json_file_value_serializer.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
@@ -1008,3 +1009,26 @@ ComponentUpdateService* ComponentUpdateServiceFactory(
DCHECK(config);
return new CrxUpdateService(config);
}
+
+// 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* ReadComponentManifest(
+ 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()) {
+ DLOG(ERROR) << "Failed to deserialize " << manifest.MaybeAsASCII() << ": "
+ << error;
+ return NULL;
+ }
+ if (!root->IsType(base::Value::TYPE_DICTIONARY)) {
+ return NULL;
+ }
+ return static_cast<base::DictionaryValue*>(root.release());
xhwang 2013/10/25 17:33:22 hmm, It'll be nice if we can return a scoped_ptr h
ddorwin 2013/10/25 19:03:40 I independently came up with that same long return
+}

Powered by Google App Engine
This is Rietveld 408576698