| 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* g_k_supported_tokens[] = {"allow-forms", | 13 const char* const kSupportedTokens[] = {"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 : g_k_supported_tokens) { | 23 for (const char* supported_token : kSupportedTokens) { |
| 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(this), element_(element) {} | 33 : DOMTokenList(this), element_(element) {} |
| (...skipping 10 matching lines...) Expand all Loading... |
| 44 const AtomicString& token_value, | 44 const AtomicString& token_value, |
| 45 ExceptionState&) const { | 45 ExceptionState&) const { |
| 46 return IsTokenSupported(token_value); | 46 return IsTokenSupported(token_value); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void HTMLIFrameElementSandbox::ValueWasSet() { | 49 void HTMLIFrameElementSandbox::ValueWasSet() { |
| 50 element_->SandboxValueWasSet(); | 50 element_->SandboxValueWasSet(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // namespace blink | 53 } // namespace blink |
| OLD | NEW |