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

Unified Diff: content/browser/webui/shared_resources_data_source.cc

Issue 613733002: Enabled CORS for chrome://resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge conflict resolved (OVERRIDE->override). Created 6 years, 2 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: content/browser/webui/shared_resources_data_source.cc
diff --git a/content/browser/webui/shared_resources_data_source.cc b/content/browser/webui/shared_resources_data_source.cc
index 09711d98aa3dd0fe74f5f44afb92efaabc697861..2ce6e147b098dc598f75b2d7e0577de0256f26cb 100644
--- a/content/browser/webui/shared_resources_data_source.cc
+++ b/content/browser/webui/shared_resources_data_source.cc
@@ -89,3 +89,17 @@ std::string SharedResourcesDataSource::GetMimeType(
net::GetMimeTypeFromFile(base::FilePath().AppendASCII(path), &mime_type);
return mime_type;
}
+
+std::string
+SharedResourcesDataSource::GetAccessControlAllowOriginForOrigin(
+ const std::string& origin) const {
+ // For now we give access only for "chrome://*" origins.
+ // According to CORS spec, Access-Control-Allow-Origin header doesn't support
+ // wildcards, so we need to set its value explicitly by passing the |origin|
+ // back.
+ std::string allowed_origin_prefix = content::kChromeUIScheme;
+ allowed_origin_prefix += "://";
+ if (origin.find(allowed_origin_prefix) != 0)
+ return "none";
+ return origin;
+}
« no previous file with comments | « content/browser/webui/shared_resources_data_source.h ('k') | content/browser/webui/url_data_manager_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698