Chromium Code Reviews| Index: extensions/common/manifest_handlers/csp_info.cc |
| diff --git a/extensions/common/manifest_handlers/csp_info.cc b/extensions/common/manifest_handlers/csp_info.cc |
| index 2c3838fa6351daad489a6fb16d9830d7775719d2..02c9e980e39a3cb5a649b387ec95faf6ab711eff 100644 |
| --- a/extensions/common/manifest_handlers/csp_info.cc |
| +++ b/extensions/common/manifest_handlers/csp_info.cc |
| @@ -9,6 +9,7 @@ |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/values.h" |
| #include "extensions/common/csp_validator.h" |
| +#include "extensions/common/install_warning.h" |
| #include "extensions/common/manifest_constants.h" |
| #include "extensions/common/manifest_handlers/sandboxed_page_info.h" |
| @@ -109,7 +110,8 @@ bool CSPHandler::Parse(Extension* extension, base::string16* error) { |
| kDefaultContentSecurityPolicy; |
| CHECK(ContentSecurityPolicyIsSecure(content_security_policy, |
|
not at google - send to devlin
2014/12/01 19:19:31
Indeed I find these changes hard to reason about b
|
| - GetValidatorOptions(extension))); |
| + GetValidatorOptions(extension), |
| + NULL, NULL)); |
| extension->SetManifestData(keys::kContentSecurityPolicy, |
| new CSPInfo(content_security_policy)); |
| } |
| @@ -125,11 +127,14 @@ bool CSPHandler::Parse(Extension* extension, base::string16* error) { |
| *error = base::ASCIIToUTF16(errors::kInvalidContentSecurityPolicy); |
| return false; |
| } |
| + std::string sanitized_csp; |
| + std::vector<InstallWarning> warnings; |
| if (extension->manifest_version() >= 2 && |
| !ContentSecurityPolicyIsSecure(content_security_policy, |
| - GetValidatorOptions(extension))) { |
| - *error = base::ASCIIToUTF16(errors::kInsecureContentSecurityPolicy); |
| - return false; |
| + GetValidatorOptions(extension), |
| + &sanitized_csp, &warnings)) { |
| + extension->AddInstallWarnings(warnings); |
| + content_security_policy = sanitized_csp; |
| } |
| extension->SetManifestData(keys::kContentSecurityPolicy, |