Chromium Code Reviews| 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..c9a47dc6820f8eb25f76bfe835aeaae3a525e359 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp |
| @@ -0,0 +1,64 @@ |
| +// 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/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, const PaymentOptions& options, const ScriptValue& data) |
| +{ |
| + return new PaymentRequest(context, supportedMethods, details, options, data); |
| +} |
| + |
| +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) |
| + : ActiveDOMObject(context) |
| + , m_supportedMethods(supportedMethods) |
| + , m_details(details) |
| + , m_options(options) |
| +{ |
| + if (!data.isEmpty() && data.isObject()) |
| + m_serializedData = SerializedScriptValueFactory::instance().createAndSwallowExceptions(v8::Isolate::GetCurrent(), data.v8Value())->toWireString(); |
|
Marijn Kruisselbrink
2016/02/19 22:39:44
Ultimately createAndSwallowExceptions here is wron
please use gerrit instead
2016/02/26 21:06:28
Done.
|
| + |
| + suspendIfNeeded(); |
| +} |
| + |
| +} // namespace blink |