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

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

Issue 10458063: Add sanbdoxed_pages to allow extension/app pages to be served in a sandboxed, unique origin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 6 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/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 54e056617ede1fb55352371f612050bdb4ffb5de..22b1e0db84d377566e405c6e549ff05d4473cbfe 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -526,6 +526,11 @@ bool Extension::HasWebAccessibleResources() const {
return false;
}
+bool Extension::IsResourceSandboxed(const std::string& relative_path) const {
+ return sandboxed_resources_.find(relative_path) !=
+ sandboxed_resources_.end();
+}
+
bool Extension::GenerateId(const std::string& input, std::string* output) {
DCHECK(output);
uint8 hash[Extension::kIdSize];
@@ -1280,6 +1285,7 @@ bool Extension::LoadSharedFeatures(
!LoadPlugins(error) ||
!LoadNaClModules(error) ||
!LoadWebAccessibleResources(error) ||
+ !LoadSandboxedResources(error) ||
!CheckRequirements(error) ||
!LoadDefaultLocale(error) ||
!LoadOfflineEnabled(error) ||
@@ -1571,6 +1577,29 @@ bool Extension::LoadWebAccessibleResources(string16* error) {
return true;
}
+bool Extension::LoadSandboxedResources(string16* error) {
+ if (!manifest_->HasKey(keys::kSandboxedResources))
+ return true;
+ ListValue* list_value;
Aaron Boodman 2012/06/04 07:05:42 = NULL;
Mihai Parparita -not on Chrome 2012/06/05 04:32:40 Done (though I don't think it's necessary; we don'
+ if (!manifest_->GetList(keys::kSandboxedResources, &list_value)) {
+ *error = ASCIIToUTF16(errors::kInvalidSandboxedResourcesList);
+ return false;
+ }
+ for (size_t i = 0; i < list_value->GetSize(); ++i) {
+ std::string relative_path;
+ if (!list_value->GetString(i, &relative_path)) {
+ *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
+ errors::kInvalidSandboxedResource, base::IntToString(i));
+ return false;
+ }
+ if (relative_path[0] != '/')
+ relative_path = '/' + relative_path;
+ sandboxed_resources_.insert(relative_path);
+ }
+
+ return true;
+}
+
// These are not actually persisted (they're only used by the store), but
// still validated.
bool Extension::CheckRequirements(string16* error) {

Powered by Google App Engine
This is Rietveld 408576698