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

Unified Diff: chrome/common/extensions/extension.cc

Issue 12886023: Remove SandboxedPages and SandboxedCSP from Extension Class (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_set.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 98d530c1bc820e354bc472dd9ee874065cb5c173..2e43dce320a452b72fbcb122cde5bf60a566e0e4 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -32,8 +32,6 @@
#include "chrome/common/extensions/api/plugins/plugins_handler.h"
#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_icon_set.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
#include "chrome/common/extensions/feature_switch.h"
@@ -68,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 {
@@ -91,9 +86,6 @@ const char kPrivate[] = "PRIVATE";
const int kRSAKeySize = 1024;
-const char kDefaultSandboxedPageContentSecurityPolicy[] =
- "sandbox allow-scripts allow-forms allow-popups";
-
const char kThumbsWhiteListedExtension[] = "khopmbdjffemhegeeobelklnbglcdgfh";
// A singleton object containing global data needed by the extension objects.
@@ -316,17 +308,6 @@ 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_ :
- CSPInfo::GetContentSecurityPolicy(this);
-}
-
ExtensionResource Extension::GetResource(
const std::string& relative_path) const {
std::string new_path = relative_path;
@@ -1656,7 +1637,6 @@ bool Extension::LoadSharedFeatures(string16* error) {
if (!LoadDescription(error) ||
!ManifestHandler::ParseExtension(this, error) ||
!LoadNaClModules(error) ||
- !LoadSandboxedPages(error) ||
!LoadKioskEnabled(error) ||
!LoadOfflineEnabled(error))
return false;
@@ -1739,58 +1719,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::LoadKioskEnabled(string16* error) {
if (!manifest_->HasKey(keys::kKioskEnabled))
return true;
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698