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

Unified Diff: third_party/WebKit/Source/core/html/HTMLIFrameElementSandbox.cpp

Issue 2011763006: Add an iframe permissions= attribute for implementing permission delegation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-delegation-1-flag
Patch Set: Blink-side Created 4 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: third_party/WebKit/Source/core/html/HTMLIFrameElementSandbox.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLIFrameElementSandbox.cpp b/third_party/WebKit/Source/core/html/HTMLIFrameElementSandbox.cpp
index 8a366af4c5f8544cd8ff28e3241a5478f06b2755..da3ca5a320138e6c7203ad221d2e108429bfc42d 100644
--- a/third_party/WebKit/Source/core/html/HTMLIFrameElementSandbox.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLIFrameElementSandbox.cpp
@@ -6,37 +6,42 @@
namespace blink {
-HTMLIFrameElementSandbox::HTMLIFrameElementSandbox(DOMTokenListObserver* observer)
- : DOMTokenList(observer)
+namespace {
+
+const char* kSupportedTokens[] = {
+ "allow-forms",
+ "allow-modals",
+ "allow-pointer-lock",
+ "allow-popups",
+ "allow-popups-to-escape-sandbox",
+ "allow-same-origin",
+ "allow-scripts",
+ "allow-top-navigation"
+};
+
+bool IsTokenSupported(const AtomicString& token)
tkent 2016/06/23 04:57:28 With the current Blink coding style, this should b
raymes 2016/06/27 08:09:50 Done.
{
+ for (const char* supportedToken : kSupportedTokens) {
+ if (token == supportedToken)
+ return true;
+ }
+ return false;
}
-HTMLIFrameElementSandbox::~HTMLIFrameElementSandbox()
+} // namespace
+
+HTMLIFrameElementSandbox::HTMLIFrameElementSandbox(DOMTokenListObserver* observer)
+ : DOMTokenList(observer)
{
}
-using SandboxSupportedTokens = HashSet<AtomicString>;
-
-static SandboxSupportedTokens& supportedTokens()
+HTMLIFrameElementSandbox::~HTMLIFrameElementSandbox()
{
- DEFINE_STATIC_LOCAL(SandboxSupportedTokens, supportedValues, ());
- if (supportedValues.isEmpty()) {
- supportedValues.add("allow-forms");
- supportedValues.add("allow-modals");
- supportedValues.add("allow-pointer-lock");
- supportedValues.add("allow-popups");
- supportedValues.add("allow-popups-to-escape-sandbox");
- supportedValues.add("allow-same-origin");
- supportedValues.add("allow-scripts");
- supportedValues.add("allow-top-navigation");
- }
-
- return supportedValues;
}
bool HTMLIFrameElementSandbox::validateTokenValue(const AtomicString& tokenValue, ExceptionState&) const
{
- return supportedTokens().contains(tokenValue);
+ return IsTokenSupported(tokenValue);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698