| Index: third_party/WebKit/Source/modules/payments/PaymentInstruments.cpp
|
| diff --git a/third_party/WebKit/Source/modules/payments/PaymentInstruments.cpp b/third_party/WebKit/Source/modules/payments/PaymentInstruments.cpp
|
| index 0b686f23f9f40d6a9c6f384fb2f3be90c265c816..fe1336b7c35e7f35730d05a230bc4e8abd9a6753 100644
|
| --- a/third_party/WebKit/Source/modules/payments/PaymentInstruments.cpp
|
| +++ b/third_party/WebKit/Source/modules/payments/PaymentInstruments.cpp
|
| @@ -53,9 +53,22 @@ PaymentInstruments::PaymentInstruments(
|
| : manager_(manager) {}
|
|
|
| ScriptPromise PaymentInstruments::deleteInstrument(
|
| + ScriptState* script_state,
|
| const String& instrument_key) {
|
| - NOTIMPLEMENTED();
|
| - return ScriptPromise();
|
| + if (!manager_.is_bound()) {
|
| + return ScriptPromise::RejectWithDOMException(
|
| + script_state,
|
| + DOMException::Create(kInvalidStateError, kPaymentManagerUnavailable));
|
| + }
|
| +
|
| + ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state);
|
| + ScriptPromise promise = resolver->Promise();
|
| +
|
| + manager_->DeletePaymentInstrument(
|
| + instrument_key, ConvertToBaseCallback(WTF::Bind(
|
| + &PaymentInstruments::onDeletePaymentInstrument,
|
| + WrapPersistent(this), WrapPersistent(resolver))));
|
| + return promise;
|
| }
|
|
|
| ScriptPromise PaymentInstruments::get(ScriptState* script_state,
|
| @@ -130,6 +143,14 @@ ScriptPromise PaymentInstruments::set(ScriptState* script_state,
|
|
|
| DEFINE_TRACE(PaymentInstruments) {}
|
|
|
| +void PaymentInstruments::onDeletePaymentInstrument(
|
| + ScriptPromiseResolver* resolver,
|
| + payments::mojom::blink::PaymentHandlerStatus status) {
|
| + DCHECK(resolver);
|
| + resolver->Resolve(status ==
|
| + payments::mojom::blink::PaymentHandlerStatus::SUCCESS);
|
| +}
|
| +
|
| void PaymentInstruments::onGetPaymentInstrument(
|
| ScriptPromiseResolver* resolver,
|
| payments::mojom::blink::PaymentInstrumentPtr stored_instrument,
|
|
|