1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
// Copyright 2017 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.
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_PAYMENTS_PAYMENT_INSTRUMENTS_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_PAYMENTS_PAYMENT_INSTRUMENTS_H_
#include "base/macros.h"
#include "third_party/blink/public/mojom/payments/payment_app.mojom-blink.h"
#include "third_party/blink/public/mojom/permissions/permission.mojom-blink.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
class ExceptionState;
class PaymentInstrument;
class ScriptPromise;
class ScriptPromiseResolver;
class ScriptState;
class PaymentInstrumentParameter;
class MODULES_EXPORT PaymentInstruments final : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
explicit PaymentInstruments(
const HeapMojoRemote<payments::mojom::blink::PaymentManager,
HeapMojoWrapperMode::kWithoutContextObserver>&,
ExecutionContext*);
ScriptPromise deleteInstrument(ScriptState*,
const String& instrument_key,
ExceptionState&);
ScriptPromise get(ScriptState*,
const String& instrument_key,
ExceptionState&);
ScriptPromise keys(ScriptState*, ExceptionState&);
ScriptPromise has(ScriptState*,
const String& instrument_key,
ExceptionState&);
ScriptPromise set(ScriptState*,
const String& instrument_key,
const PaymentInstrument* details,
ExceptionState&);
ScriptPromise clear(ScriptState*, ExceptionState&);
void Trace(Visitor*) override;
private:
mojom::blink::PermissionService* GetPermissionService(ScriptState*);
void OnRequestPermission(ScriptPromiseResolver*,
const String&,
PaymentInstrumentParameter*,
mojom::blink::PermissionStatus);
void onDeletePaymentInstrument(ScriptPromiseResolver*,
payments::mojom::blink::PaymentHandlerStatus);
void onGetPaymentInstrument(ScriptPromiseResolver*,
payments::mojom::blink::PaymentInstrumentPtr,
payments::mojom::blink::PaymentHandlerStatus);
void onKeysOfPaymentInstruments(ScriptPromiseResolver*,
const Vector<String>&,
payments::mojom::blink::PaymentHandlerStatus);
void onHasPaymentInstrument(ScriptPromiseResolver*,
payments::mojom::blink::PaymentHandlerStatus);
void onSetPaymentInstrument(ScriptPromiseResolver*,
payments::mojom::blink::PaymentHandlerStatus);
void onClearPaymentInstruments(ScriptPromiseResolver*,
payments::mojom::blink::PaymentHandlerStatus);
const HeapMojoRemote<payments::mojom::blink::PaymentManager,
HeapMojoWrapperMode::kWithoutContextObserver>& manager_;
HeapMojoRemote<mojom::blink::PermissionService,
HeapMojoWrapperMode::kWithoutContextObserver>
permission_service_;
DISALLOW_COPY_AND_ASSIGN(PaymentInstruments);
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_PAYMENTS_PAYMENT_INSTRUMENTS_H_
|