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

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.h

Issue 1702223002: PaymentRequest API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 #ifndef PaymentRequest_h
6 #define PaymentRequest_h
7
8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptValue.h"
10 #include "bindings/core/v8/ScriptWrappable.h"
11 #include "core/dom/ContextLifecycleObserver.h"
12 #include "core/events/EventTarget.h"
13 #include "modules/payments/PaymentDetails.h"
14 #include "modules/payments/PaymentOptions.h"
15 #include "modules/payments/ShippingAddress.h"
16 #include "platform/heap/Handle.h"
17 #include "wtf/Noncopyable.h"
18 #include "wtf/Vector.h"
19 #include "wtf/text/WTFString.h"
20
21 namespace blink {
22
23 class ExceptionState;
24 class ExecutionContext;
25 class ScriptState;
26
27 class PaymentRequest final : public RefCountedGarbageCollectedEventTargetWithInl ineData<PaymentRequest>, public ContextLifecycleObserver {
haraken 2016/03/01 02:33:47 I don't think PaymentRequest needs to be a Context
please use gerrit instead 2016/03/02 00:32:53 Done.
28 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PaymentRequest);
29 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PaymentRequest);
30 DEFINE_WRAPPERTYPEINFO();
31 WTF_MAKE_NONCOPYABLE(PaymentRequest);
32
33 public:
34 static PaymentRequest* create(ExecutionContext*, const Vector<String>& suppo rtedMethods, const PaymentDetails&, ExceptionState&);
35 static PaymentRequest* create(ExecutionContext*, const Vector<String>& suppo rtedMethods, const PaymentDetails&, const PaymentOptions&, ExceptionState&);
36 static PaymentRequest* create(ExecutionContext*, const Vector<String>& suppo rtedMethods, const PaymentDetails&, const PaymentOptions&, const ScriptValue& da ta, ExceptionState&);
37
38 virtual ~PaymentRequest();
39
40 ScriptPromise show(ScriptState*);
41 void abort();
42
43 ShippingAddress* shippingAddress() const { return m_shippingAddress.get(); }
44 const String& shippingOption() const { return m_shippingOption; }
45
46 DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingaddresschange);
47 DEFINE_ATTRIBUTE_EVENT_LISTENER(shippingoptionchange);
48
49 // EventTargetWithInlineData:
50 const AtomicString& interfaceName() const override;
51 ExecutionContext* executionContext() const override;
52
53 DECLARE_TRACE();
54
55 private:
56 PaymentRequest(ExecutionContext*, const Vector<String>& supportedMethods, co nst PaymentDetails&, const PaymentOptions&, const ScriptValue& data, ExceptionSt ate&);
57
58 Vector<String> m_supportedMethods;
59 PaymentDetails m_details;
60 PaymentOptions m_options;
61 String m_stringifiedData;
62 Member<ShippingAddress> m_shippingAddress;
63 String m_shippingOption;
64 };
65
66 } // namespace blink
67
68 #endif // PaymentRequest_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698