Chromium Code Reviews| 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) { |