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

Unified Diff: third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp

Issue 2394473002: iframes with allowpaymentrequest attribute are allowed to make payment requests. (Closed)
Patch Set: Rebased Created 4 years, 2 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/modules/payments/HTMLIFrameElementPayments.cpp
diff --git a/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp b/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..6ce4b014a285edca5a6ecd3dc35d15b6d407c7c0
--- /dev/null
+++ b/third_party/WebKit/Source/modules/payments/HTMLIFrameElementPayments.cpp
@@ -0,0 +1,58 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "modules/payments/HTMLIFrameElementPayments.h"
+
+#include "core/dom/QualifiedName.h"
+#include "core/html/HTMLIFrameElement.h"
+
+namespace blink {
+
+HTMLIFrameElementPayments::HTMLIFrameElementPayments() {}
+
+// static
+const char* HTMLIFrameElementPayments::supplementName() {
+ return "HTMLIFrameElementPayments";
+}
+
+// static
+bool HTMLIFrameElementPayments::fastHasAttribute(
+ const QualifiedName& name,
+ const HTMLIFrameElement& element) {
+ DCHECK(name == HTMLNames::allowpaymentrequestAttr);
+ return element.fastHasAttribute(name);
+}
+
+// static
+void HTMLIFrameElementPayments::setBooleanAttribute(const QualifiedName& name,
+ HTMLIFrameElement& element,
+ bool value) {
+ DCHECK(name == HTMLNames::allowpaymentrequestAttr);
+ element.setBooleanAttribute(name, value);
+}
+
+// static
+HTMLIFrameElementPayments& HTMLIFrameElementPayments::from(
+ HTMLIFrameElement& iframe) {
+ HTMLIFrameElementPayments* supplement =
+ static_cast<HTMLIFrameElementPayments*>(
+ Supplement<HTMLIFrameElement>::from(iframe, supplementName()));
+ if (!supplement) {
+ supplement = new HTMLIFrameElementPayments();
+ provideTo(iframe, supplementName(), supplement);
+ }
+ return *supplement;
+}
+
+// static
+bool HTMLIFrameElementPayments::allowPaymentRequest(
+ HTMLIFrameElement& element) {
+ return element.fastHasAttribute(HTMLNames::allowpaymentrequestAttr);
+}
+
+DEFINE_TRACE(HTMLIFrameElementPayments) {
+ Supplement<HTMLIFrameElement>::trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698