summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorbauerb <bauerb@chromium.org>2015-01-05 16:26:30 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-06 00:27:15 +0000
commit4c2863e68026d612a2155e6a9a3093e2301f69bd (patch)
tree3c9651a850abe97f59009e443be9d3588685e7d0 /extensions
parent9f9b3b114563766e5a0c0d49f76ab9e109fa16ab (diff)
downloadchromium_src-4c2863e68026d612a2155e6a9a3093e2301f69bd.zip
chromium_src-4c2863e68026d612a2155e6a9a3093e2301f69bd.tar.gz
chromium_src-4c2863e68026d612a2155e6a9a3093e2301f69bd.tar.bz2
Use SafeJsonParser in WebResourceService and Management extension API.
BUG=437972 Review URL: https://codereview.chromium.org/817283002 Cr-Commit-Position: refs/heads/master@{#310008}
Diffstat (limited to 'extensions')
-rw-r--r--extensions/browser/api/management/management_api.cc11
-rw-r--r--extensions/browser/api/management/management_api.h2
2 files changed, 9 insertions, 4 deletions
diff --git a/extensions/browser/api/management/management_api.cc b/extensions/browser/api/management/management_api.cc
index ea6d6c5..8f5b579 100644
--- a/extensions/browser/api/management/management_api.cc
+++ b/extensions/browser/api/management/management_api.cc
@@ -356,13 +356,18 @@ bool ManagementGetPermissionWarningsByManifestFunction::RunAsync() {
}
void ManagementGetPermissionWarningsByManifestFunction::OnParseSuccess(
- scoped_ptr<base::DictionaryValue> parsed_manifest) {
- CHECK(parsed_manifest.get());
+ scoped_ptr<base::Value> value) {
+ if (!value->IsType(base::Value::TYPE_DICTIONARY)) {
+ OnParseFailure(keys::kManifestParseError);
+ return;
+ }
+ const base::DictionaryValue* parsed_manifest =
+ static_cast<const base::DictionaryValue*>(value.get());
scoped_refptr<Extension> extension =
Extension::Create(base::FilePath(), Manifest::INVALID_LOCATION,
*parsed_manifest, Extension::NO_FLAGS, &error_);
- if (!extension.get()) {
+ if (!extension) {
OnParseFailure(keys::kExtensionCreateError);
return;
}
diff --git a/extensions/browser/api/management/management_api.h b/extensions/browser/api/management/management_api.h
index b695470..ab7fb84 100644
--- a/extensions/browser/api/management/management_api.h
+++ b/extensions/browser/api/management/management_api.h
@@ -83,7 +83,7 @@ class ManagementGetPermissionWarningsByManifestFunction
MANAGEMENT_GETPERMISSIONWARNINGSBYMANIFEST);
// Called when utility process finishes.
- void OnParseSuccess(scoped_ptr<base::DictionaryValue> parsed_manifest);
+ void OnParseSuccess(scoped_ptr<base::Value> value);
void OnParseFailure(const std::string& error);
protected: