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

Unified Diff: Source/platform/weborigin/SchemeRegistry.h

Issue 730203007: CSP: Permit exempting schemes only for certain policy areas. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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: Source/platform/weborigin/SchemeRegistry.h
diff --git a/Source/platform/weborigin/SchemeRegistry.h b/Source/platform/weborigin/SchemeRegistry.h
index d303f556b46620f1a8725886f52ff9b21cb303e1..2357bf5f8a456269f7a47a2920be9b7d0682ebc6 100644
--- a/Source/platform/weborigin/SchemeRegistry.h
+++ b/Source/platform/weborigin/SchemeRegistry.h
@@ -28,19 +28,23 @@
#define SchemeRegistry_h
#include "platform/PlatformExport.h"
+#include "wtf/HashMap.h"
#include "wtf/HashSet.h"
#include "wtf/text/StringHash.h"
#include "wtf/text/WTFString.h"
namespace blink {
-typedef HashSet<String, CaseFoldingHash> URLSchemesMap;
+using URLSchemesSet = HashSet<String, CaseFoldingHash>;
+
+template <typename T>
+using URLSchemesMap = HashMap<String, T, CaseFoldingHash>;
class PLATFORM_EXPORT SchemeRegistry {
public:
static void registerURLSchemeAsLocal(const String&);
static void removeURLSchemeRegisteredAsLocal(const String&);
- static const URLSchemesMap& localSchemes();
+ static const URLSchemesSet& localSchemes();
static bool shouldTreatURLSchemeAsLocal(const String&);
@@ -87,9 +91,17 @@ public:
// Allow resources from some schemes to load on a page, regardless of its
// Content Security Policy.
- static void registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme);
+ // This enum should be kept in sync with public/web/WebSecurityPolicy.h.
+ enum PolicyAreas : uint32_t {
+ PolicyAreaNone = 0,
+ PolicyAreaImage = 1 << 0,
+ PolicyAreaStyle = 1 << 1,
+ // Add more policy areas as needed by clients.
+ PolicyAreaAll = ~static_cast<uint32_t>(0),
+ };
+ static void registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme, PolicyAreas = PolicyAreaAll);
static void removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(const String& scheme);
- static bool schemeShouldBypassContentSecurityPolicy(const String& scheme);
+ static bool schemeShouldBypassContentSecurityPolicy(const String& scheme, PolicyAreas = PolicyAreaAll);
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698