| Index: chrome/common/extensions/extension.cc
|
| diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
|
| index 32c4efb894e172c907542b4913914b253084066a..081d6227eecc8c83c4b3ff8efecbda9231e2e930 100644
|
| --- a/chrome/common/extensions/extension.cc
|
| +++ b/chrome/common/extensions/extension.cc
|
| @@ -33,7 +33,6 @@
|
| #include "chrome/common/extensions/api/themes/theme_handler.h"
|
| #include "chrome/common/extensions/background_info.h"
|
| #include "chrome/common/extensions/csp_handler.h"
|
| -#include "chrome/common/extensions/csp_validator.h"
|
| #include "chrome/common/extensions/extension_manifest_constants.h"
|
| #include "chrome/common/extensions/feature_switch.h"
|
| #include "chrome/common/extensions/features/base_feature_provider.h"
|
| @@ -45,6 +44,7 @@
|
| #include "chrome/common/extensions/permissions/api_permission_set.h"
|
| #include "chrome/common/extensions/permissions/permission_set.h"
|
| #include "chrome/common/extensions/permissions/permissions_info.h"
|
| +#include "chrome/common/extensions/sandboxed_handler.h"
|
| #include "chrome/common/extensions/user_script.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "crypto/sha2.h"
|
| @@ -66,9 +66,6 @@ namespace values = extension_manifest_values;
|
| namespace errors = extension_manifest_errors;
|
| namespace info_keys = extension_info_keys;
|
|
|
| -using extensions::csp_validator::ContentSecurityPolicyIsLegal;
|
| -using extensions::csp_validator::ContentSecurityPolicyIsSandboxed;
|
| -
|
| namespace extensions {
|
|
|
| namespace {
|
| @@ -89,9 +86,6 @@ const char kPrivate[] = "PRIVATE";
|
|
|
| const int kRSAKeySize = 1024;
|
|
|
| -const char kDefaultSandboxedPageContentSecurityPolicy[] =
|
| - "sandbox allow-scripts allow-forms allow-popups";
|
| -
|
| // Converts a normal hexadecimal string into the alphabet used by extensions.
|
| // We use the characters 'a'-'p' instead of '0'-'f' to avoid ever having a
|
| // completely numeric host, since some software interprets that as an IP
|
| @@ -365,14 +359,10 @@ bool Extension::ResourceMatches(const URLPatternSet& pattern_set,
|
| return pattern_set.MatchesURL(extension_url_.Resolve(resource));
|
| }
|
|
|
| -bool Extension::IsSandboxedPage(const std::string& relative_path) const {
|
| - return ResourceMatches(sandboxed_pages_, relative_path);
|
| -}
|
| -
|
| std::string Extension::GetResourceContentSecurityPolicy(
|
| const std::string& relative_path) const {
|
| - return IsSandboxedPage(relative_path) ?
|
| - sandboxed_pages_content_security_policy_ :
|
| + return SandboxedInfo::IsSandboxedPage(this, relative_path) ?
|
| + SandboxedInfo::GetContentSecurityPolicy(this) :
|
| CSPInfo::GetContentSecurityPolicy(this);
|
| }
|
|
|
| @@ -1722,7 +1712,6 @@ bool Extension::LoadSharedFeatures(string16* error) {
|
| if (!LoadDescription(error) ||
|
| !ManifestHandler::ParseExtension(this, error) ||
|
| !LoadNaClModules(error) ||
|
| - !LoadSandboxedPages(error) ||
|
| !LoadRequirements(error) ||
|
| !LoadOfflineEnabled(error))
|
| return false;
|
| @@ -1805,58 +1794,6 @@ bool Extension::LoadNaClModules(string16* error) {
|
| return true;
|
| }
|
|
|
| -bool Extension::LoadSandboxedPages(string16* error) {
|
| - if (!manifest_->HasPath(keys::kSandboxedPages))
|
| - return true;
|
| -
|
| - const ListValue* list_value = NULL;
|
| - if (!manifest_->GetList(keys::kSandboxedPages, &list_value)) {
|
| - *error = ASCIIToUTF16(errors::kInvalidSandboxedPagesList);
|
| - return false;
|
| - }
|
| - for (size_t i = 0; i < list_value->GetSize(); ++i) {
|
| - std::string relative_path;
|
| - if (!list_value->GetString(i, &relative_path)) {
|
| - *error = ErrorUtils::FormatErrorMessageUTF16(
|
| - errors::kInvalidSandboxedPage, base::IntToString(i));
|
| - return false;
|
| - }
|
| - URLPattern pattern(URLPattern::SCHEME_EXTENSION);
|
| - if (pattern.Parse(extension_url_.spec()) != URLPattern::PARSE_SUCCESS) {
|
| - *error = ErrorUtils::FormatErrorMessageUTF16(
|
| - errors::kInvalidURLPatternError, extension_url_.spec());
|
| - return false;
|
| - }
|
| - while (relative_path[0] == '/')
|
| - relative_path = relative_path.substr(1, relative_path.length() - 1);
|
| - pattern.SetPath(pattern.path() + relative_path);
|
| - sandboxed_pages_.AddPattern(pattern);
|
| - }
|
| -
|
| - if (manifest_->HasPath(keys::kSandboxedPagesCSP)) {
|
| - if (!manifest_->GetString(
|
| - keys::kSandboxedPagesCSP, &sandboxed_pages_content_security_policy_)) {
|
| - *error = ASCIIToUTF16(errors::kInvalidSandboxedPagesCSP);
|
| - return false;
|
| - }
|
| -
|
| - if (!ContentSecurityPolicyIsLegal(
|
| - sandboxed_pages_content_security_policy_) ||
|
| - !ContentSecurityPolicyIsSandboxed(
|
| - sandboxed_pages_content_security_policy_, GetType())) {
|
| - *error = ASCIIToUTF16(errors::kInvalidSandboxedPagesCSP);
|
| - return false;
|
| - }
|
| - } else {
|
| - sandboxed_pages_content_security_policy_ =
|
| - kDefaultSandboxedPageContentSecurityPolicy;
|
| - CHECK(ContentSecurityPolicyIsSandboxed(
|
| - sandboxed_pages_content_security_policy_, GetType()));
|
| - }
|
| -
|
| - return true;
|
| -}
|
| -
|
| bool Extension::LoadRequirements(string16* error) {
|
| // Before parsing requirements from the manifest, automatically default the
|
| // NPAPI plugin requirement based on whether it includes NPAPI plugins.
|
|
|