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

Side by Side 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: Reduce the API surface 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 unified diff | Download patch
OLDNEW
(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/SerializedScriptValueFactory.h"
8 #include "core/dom/DOMException.h"
9 #include "core/dom/ExceptionCode.h"
10 #include "modules/EventTargetModulesNames.h"
11
12 namespace blink {
13
14 // static
15 PaymentRequest* PaymentRequest::create(ExecutionContext* context, const Vector<S tring>& supportedMethods, const PaymentDetails& details, const PaymentOptions& o ptions, const ScriptValue& data)
16 {
17 return new PaymentRequest(context, supportedMethods, details, options, data) ;
18 }
19
20 PaymentRequest::~PaymentRequest()
21 {
22 }
23
24 ScriptPromise PaymentRequest::show(ScriptState* scriptState)
25 {
26 return ScriptPromise::rejectWithDOMException(scriptState, DOMException::crea te(NotSupportedError, "Not implemented."));
27 }
28
29 void PaymentRequest::abort()
30 {
31 }
32
33 const AtomicString& PaymentRequest::interfaceName() const
34 {
35 return EventTargetNames::PaymentRequest;
36 }
37
38 ExecutionContext* PaymentRequest::executionContext() const
39 {
40 return ActiveDOMObject::executionContext();
41 }
42
43 DEFINE_TRACE(PaymentRequest)
44 {
45 visitor->trace(m_details);
46 visitor->trace(m_options);
47 visitor->trace(m_shippingAddress);
48 RefCountedGarbageCollectedEventTargetWithInlineData<PaymentRequest>::trace(v isitor);
49 ActiveDOMObject::trace(visitor);
50 }
51
52 PaymentRequest::PaymentRequest(ExecutionContext* context, const Vector<String>& supportedMethods, const PaymentDetails& details, const PaymentOptions& options, const ScriptValue& data)
53 : ActiveDOMObject(context)
54 , m_supportedMethods(supportedMethods)
55 , m_details(details)
56 , m_options(options)
57 {
58 if (!data.isEmpty() && data.isObject())
59 m_serializedData = SerializedScriptValueFactory::instance().createAndSwa llowExceptions(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.
60
61 suspendIfNeeded();
62 }
63
64 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698