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

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

Issue 1702223002: PaymentRequest API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Let constructor throw an exception Created 4 years, 10 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/PaymentRequest.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f368f5e55cb86cc28c134602bef3694ae564918c
--- /dev/null
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -0,0 +1,77 @@
+// 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/PaymentRequest.h"
+
+#include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/SerializedScriptValueFactory.h"
+#include "core/dom/DOMException.h"
+#include "core/dom/ExceptionCode.h"
+#include "modules/EventTargetModulesNames.h"
+
+namespace blink {
+
+// static
+PaymentRequest* PaymentRequest::create(ExecutionContext* context, const Vector<String>& supportedMethods, const PaymentDetails& details, ExceptionState& exceptionState)
+{
+ return new PaymentRequest(context, supportedMethods, details, PaymentOptions(), ScriptValue(), exceptionState);
+}
+
+// static
+PaymentRequest* PaymentRequest::create(ExecutionContext* context, const Vector<String>& supportedMethods, const PaymentDetails& details, const PaymentOptions& options, ExceptionState& exceptionState)
+{
+ return new PaymentRequest(context, supportedMethods, details, options, ScriptValue(), exceptionState);
+}
+
+// static
+PaymentRequest* PaymentRequest::create(ExecutionContext* context, const Vector<String>& supportedMethods, const PaymentDetails& details, const PaymentOptions& options, const ScriptValue& data, ExceptionState& exceptionState)
+{
+ return new PaymentRequest(context, supportedMethods, details, options, data, exceptionState);
+}
+
+PaymentRequest::~PaymentRequest()
+{
+}
+
+ScriptPromise PaymentRequest::show(ScriptState* scriptState)
+{
+ return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(NotSupportedError, "Not implemented."));
+}
+
+void PaymentRequest::abort()
+{
+}
+
+const AtomicString& PaymentRequest::interfaceName() const
+{
+ return EventTargetNames::PaymentRequest;
+}
+
+ExecutionContext* PaymentRequest::executionContext() const
+{
+ return ActiveDOMObject::executionContext();
+}
+
+DEFINE_TRACE(PaymentRequest)
+{
+ visitor->trace(m_details);
+ visitor->trace(m_options);
+ visitor->trace(m_shippingAddress);
+ RefCountedGarbageCollectedEventTargetWithInlineData<PaymentRequest>::trace(visitor);
+ ActiveDOMObject::trace(visitor);
+}
+
+PaymentRequest::PaymentRequest(ExecutionContext* context, const Vector<String>& supportedMethods, const PaymentDetails& details, const PaymentOptions& options, const ScriptValue& data, ExceptionState& exceptionState)
+ : ActiveDOMObject(context)
+ , m_supportedMethods(supportedMethods)
+ , m_details(details)
+ , m_options(options)
+{
+ if (!data.isEmpty() && data.isObject())
+ m_serializedData = SerializedScriptValueFactory::instance().create(v8::Isolate::GetCurrent(), data.v8Value(), nullptr, nullptr, nullptr, exceptionState)->toWireString();
please use gerrit instead 2016/02/23 16:56:15 Note from Haavard: WebString detailsString = Nati
+
+ suspendIfNeeded();
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698