OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/html/HTMLIFrameElementSandbox.h" | 5 #include "core/html/HTMLIFrameElementSandbox.h" |
6 | 6 |
7 #include "core/html/HTMLIFrameElement.h" | 7 #include "core/html/HTMLIFrameElement.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 const char* const kSupportedTokens[] = {"allow-forms", | 13 const char* const kSupportedSandboxTokens[] = {"allow-forms", |
14 "allow-modals", | 14 "allow-modals", |
15 "allow-pointer-lock", | 15 "allow-pointer-lock", |
16 "allow-popups", | 16 "allow-popups", |
17 "allow-popups-to-escape-sandbox", | 17 "allow-popups-to-escape-sandbox", |
18 "allow-same-origin", | 18 "allow-same-origin", |
19 "allow-scripts", | 19 "allow-scripts", |
20 "allow-top-navigation"}; | 20 "allow-top-navigation"}; |
21 | 21 |
22 bool IsTokenSupported(const AtomicString& token) { | 22 bool IsTokenSupported(const AtomicString& token) { |
23 for (const char* supported_token : kSupportedTokens) { | 23 for (const char* supported_token : kSupportedSandboxTokens) { |
24 if (token == supported_token) | 24 if (token == supported_token) |
25 return true; | 25 return true; |
26 } | 26 } |
27 return false; | 27 return false; |
28 } | 28 } |
29 | 29 |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 HTMLIFrameElementSandbox::HTMLIFrameElementSandbox(HTMLIFrameElement* element) | 32 HTMLIFrameElementSandbox::HTMLIFrameElementSandbox(HTMLIFrameElement* element) |
33 : DOMTokenList(*element, HTMLNames::sandboxAttr) {} | 33 : DOMTokenList(*element, HTMLNames::sandboxAttr) {} |
34 | 34 |
35 bool HTMLIFrameElementSandbox::ValidateTokenValue( | 35 bool HTMLIFrameElementSandbox::ValidateTokenValue( |
36 const AtomicString& token_value, | 36 const AtomicString& token_value, |
37 ExceptionState&) const { | 37 ExceptionState&) const { |
38 return IsTokenSupported(token_value); | 38 return IsTokenSupported(token_value); |
39 } | 39 } |
40 | 40 |
41 } // namespace blink | 41 } // namespace blink |
OLD | NEW |