OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "modules/payments/HTMLIFrameElementPayments.h" |
| 6 |
| 7 #include "core/dom/QualifiedName.h" |
| 8 #include "core/html/HTMLIFrameElement.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 HTMLIFrameElementPayments::HTMLIFrameElementPayments() {} |
| 13 |
| 14 // static |
| 15 const char* HTMLIFrameElementPayments::supplementName() { |
| 16 return "HTMLIFrameElementPayments"; |
| 17 } |
| 18 |
| 19 // static |
| 20 bool HTMLIFrameElementPayments::fastHasAttribute( |
| 21 const QualifiedName& name, |
| 22 const HTMLIFrameElement& element) { |
| 23 DCHECK(name == HTMLNames::allowpaymentrequestAttr); |
| 24 return element.fastHasAttribute(name); |
| 25 } |
| 26 |
| 27 // static |
| 28 void HTMLIFrameElementPayments::setBooleanAttribute(const QualifiedName& name, |
| 29 HTMLIFrameElement& element, |
| 30 bool value) { |
| 31 DCHECK(name == HTMLNames::allowpaymentrequestAttr); |
| 32 element.setBooleanAttribute(name, value); |
| 33 } |
| 34 |
| 35 // static |
| 36 HTMLIFrameElementPayments& HTMLIFrameElementPayments::from( |
| 37 HTMLIFrameElement& iframe) { |
| 38 HTMLIFrameElementPayments* supplement = |
| 39 static_cast<HTMLIFrameElementPayments*>( |
| 40 Supplement<HTMLIFrameElement>::from(iframe, supplementName())); |
| 41 if (!supplement) { |
| 42 supplement = new HTMLIFrameElementPayments(); |
| 43 provideTo(iframe, supplementName(), supplement); |
| 44 } |
| 45 return *supplement; |
| 46 } |
| 47 |
| 48 // static |
| 49 bool HTMLIFrameElementPayments::allowPaymentRequest( |
| 50 HTMLIFrameElement& element) { |
| 51 return element.fastHasAttribute(HTMLNames::allowpaymentrequestAttr); |
| 52 } |
| 53 |
| 54 DEFINE_TRACE(HTMLIFrameElementPayments) { |
| 55 Supplement<HTMLIFrameElement>::trace(visitor); |
| 56 } |
| 57 |
| 58 } // namespace blink |
OLD | NEW |