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

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: AssertMatchingEnums 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
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/weborigin/SchemeRegistry.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/weborigin/SchemeRegistry.h
diff --git a/Source/platform/weborigin/SchemeRegistry.h b/Source/platform/weborigin/SchemeRegistry.h
index d303f556b46620f1a8725886f52ff9b21cb303e1..fcc360f0791a35545349030253e4d2f3817654b1 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,18 @@ 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.
+ // Enforced in AssertMatchingEnums.cpp.
+ 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
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/weborigin/SchemeRegistry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698