| 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 ea22365e4eada93a07ae33991346120d1b80ce5e..829a852b2c9f100a3642c7bbcf2f0f4106675b28 100644
|
| --- a/third_party/WebKit/Source/modules/payments/PaymentInstruments.cpp
|
| +++ b/third_party/WebKit/Source/modules/payments/PaymentInstruments.cpp
|
| @@ -94,9 +94,22 @@ ScriptPromise PaymentInstruments::keys() {
|
| return ScriptPromise();
|
| }
|
|
|
| -ScriptPromise PaymentInstruments::has(const String& instrument_key) {
|
| - NOTIMPLEMENTED();
|
| - return ScriptPromise();
|
| +ScriptPromise PaymentInstruments::has(ScriptState* script_state,
|
| + const String& instrument_key) {
|
| + if (!manager_.is_bound()) {
|
| + return ScriptPromise::RejectWithDOMException(
|
| + script_state,
|
| + DOMException::Create(kInvalidStateError, kPaymentManagerUnavailable));
|
| + }
|
| +
|
| + ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state);
|
| + ScriptPromise promise = resolver->Promise();
|
| +
|
| + manager_->HasPaymentInstrument(
|
| + instrument_key, ConvertToBaseCallback(WTF::Bind(
|
| + &PaymentInstruments::onHasPaymentInstrument,
|
| + WrapPersistent(this), WrapPersistent(resolver))));
|
| + return promise;
|
| }
|
|
|
| ScriptPromise PaymentInstruments::set(ScriptState* script_state,
|
| @@ -184,6 +197,14 @@ void PaymentInstruments::onGetPaymentInstrument(
|
| resolver->Resolve(instrument);
|
| }
|
|
|
| +void PaymentInstruments::onHasPaymentInstrument(
|
| + ScriptPromiseResolver* resolver,
|
| + payments::mojom::blink::PaymentHandlerStatus status) {
|
| + DCHECK(resolver);
|
| + resolver->Resolve(status ==
|
| + payments::mojom::blink::PaymentHandlerStatus::SUCCESS);
|
| +}
|
| +
|
| void PaymentInstruments::onSetPaymentInstrument(
|
| ScriptPromiseResolver* resolver,
|
| payments::mojom::blink::PaymentHandlerStatus status) {
|
|
|