Chromium Code Reviews| 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/PaymentRequest.h" | |
| 6 | |
| 7 #include "bindings/core/v8/ExceptionState.h" | |
| 8 #include "bindings/core/v8/SerializedScriptValueFactory.h" | |
| 9 #include "core/dom/DOMException.h" | |
| 10 #include "core/dom/ExceptionCode.h" | |
| 11 #include "modules/EventTargetModulesNames.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 // static | |
| 16 PaymentRequest* PaymentRequest::create(ExecutionContext* context, const Vector<S tring>& supportedMethods, const PaymentDetails& details, ExceptionState& excepti onState) | |
| 17 { | |
| 18 return new PaymentRequest(context, supportedMethods, details, PaymentOptions (), ScriptValue(), exceptionState); | |
| 19 } | |
| 20 | |
| 21 // static | |
| 22 PaymentRequest* PaymentRequest::create(ExecutionContext* context, const Vector<S tring>& supportedMethods, const PaymentDetails& details, const PaymentOptions& o ptions, ExceptionState& exceptionState) | |
| 23 { | |
| 24 return new PaymentRequest(context, supportedMethods, details, options, Scrip tValue(), exceptionState); | |
| 25 } | |
| 26 | |
| 27 // static | |
| 28 PaymentRequest* PaymentRequest::create(ExecutionContext* context, const Vector<S tring>& supportedMethods, const PaymentDetails& details, const PaymentOptions& o ptions, const ScriptValue& data, ExceptionState& exceptionState) | |
| 29 { | |
| 30 return new PaymentRequest(context, supportedMethods, details, options, data, exceptionState); | |
| 31 } | |
| 32 | |
| 33 PaymentRequest::~PaymentRequest() | |
| 34 { | |
| 35 } | |
| 36 | |
| 37 ScriptPromise PaymentRequest::show(ScriptState* scriptState) | |
| 38 { | |
| 39 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea te(NotSupportedError, "Not implemented.")); | |
| 40 } | |
| 41 | |
| 42 void PaymentRequest::abort() | |
| 43 { | |
| 44 } | |
| 45 | |
| 46 const AtomicString& PaymentRequest::interfaceName() const | |
| 47 { | |
| 48 return EventTargetNames::PaymentRequest; | |
| 49 } | |
| 50 | |
| 51 ExecutionContext* PaymentRequest::executionContext() const | |
| 52 { | |
| 53 return ActiveDOMObject::executionContext(); | |
| 54 } | |
| 55 | |
| 56 DEFINE_TRACE(PaymentRequest) | |
| 57 { | |
| 58 visitor->trace(m_details); | |
| 59 visitor->trace(m_options); | |
| 60 visitor->trace(m_shippingAddress); | |
| 61 RefCountedGarbageCollectedEventTargetWithInlineData<PaymentRequest>::trace(v isitor); | |
| 62 ActiveDOMObject::trace(visitor); | |
| 63 } | |
| 64 | |
| 65 PaymentRequest::PaymentRequest(ExecutionContext* context, const Vector<String>& supportedMethods, const PaymentDetails& details, const PaymentOptions& options, const ScriptValue& data, ExceptionState& exceptionState) | |
| 66 : ActiveDOMObject(context) | |
| 67 , m_supportedMethods(supportedMethods) | |
| 68 , m_details(details) | |
| 69 , m_options(options) | |
| 70 { | |
| 71 if (!data.isEmpty() && data.isObject()) | |
| 72 m_serializedData = SerializedScriptValueFactory::instance().create(v8::I solate::GetCurrent(), data.v8Value(), nullptr, nullptr, nullptr, exceptionState) ->toWireString(); | |
|
please use gerrit instead
2016/02/23 16:56:15
Note from Haavard:
WebString detailsString = Nati
| |
| 73 | |
| 74 suspendIfNeeded(); | |
| 75 } | |
| 76 | |
| 77 } // namespace blink | |
| OLD | NEW |