| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/payments/PaymentRequest.h" | 5 #include "modules/payments/PaymentRequest.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/JSONValuesForV8.h" | 8 #include "bindings/core/v8/JSONValuesForV8.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 return; | 311 return; |
| 312 } | 312 } |
| 313 | 313 |
| 314 if (address->language_code.isEmpty() && !address->script_code.isEmpty()) { | 314 if (address->language_code.isEmpty() && !address->script_code.isEmpty()) { |
| 315 m_showResolver->reject(DOMException::create(SyntaxError, "If language co
de is empty, then script code should also be empty")); | 315 m_showResolver->reject(DOMException::create(SyntaxError, "If language co
de is empty, then script code should also be empty")); |
| 316 cleanUp(); | 316 cleanUp(); |
| 317 return; | 317 return; |
| 318 } | 318 } |
| 319 | 319 |
| 320 m_shippingAddress = new ShippingAddress(std::move(address)); | 320 m_shippingAddress = new ShippingAddress(std::move(address)); |
| 321 RawPtr<Event> event = Event::create(EventTypeNames::shippingaddresschange); | 321 Event* event = Event::create(EventTypeNames::shippingaddresschange); |
| 322 event->setTarget(this); | 322 event->setTarget(this); |
| 323 getExecutionContext()->getEventQueue()->enqueueEvent(event); | 323 getExecutionContext()->getEventQueue()->enqueueEvent(event); |
| 324 } | 324 } |
| 325 | 325 |
| 326 void PaymentRequest::OnShippingOptionChange(const String& shippingOptionId) | 326 void PaymentRequest::OnShippingOptionChange(const String& shippingOptionId) |
| 327 { | 327 { |
| 328 DCHECK(m_showResolver); | 328 DCHECK(m_showResolver); |
| 329 DCHECK(!m_completeResolver); | 329 DCHECK(!m_completeResolver); |
| 330 m_shippingOption = shippingOptionId; | 330 m_shippingOption = shippingOptionId; |
| 331 RawPtr<Event> event = Event::create(EventTypeNames::shippingoptionchange); | 331 Event* event = Event::create(EventTypeNames::shippingoptionchange); |
| 332 event->setTarget(this); | 332 event->setTarget(this); |
| 333 getExecutionContext()->getEventQueue()->enqueueEvent(event); | 333 getExecutionContext()->getEventQueue()->enqueueEvent(event); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void PaymentRequest::OnPaymentResponse(mojom::wtf::PaymentResponsePtr response) | 336 void PaymentRequest::OnPaymentResponse(mojom::wtf::PaymentResponsePtr response) |
| 337 { | 337 { |
| 338 DCHECK(m_showResolver); | 338 DCHECK(m_showResolver); |
| 339 DCHECK(!m_completeResolver); | 339 DCHECK(!m_completeResolver); |
| 340 m_showResolver->resolve(new PaymentResponse(std::move(response), this)); | 340 m_showResolver->resolve(new PaymentResponse(std::move(response), this)); |
| 341 } | 341 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 358 | 358 |
| 359 void PaymentRequest::cleanUp() | 359 void PaymentRequest::cleanUp() |
| 360 { | 360 { |
| 361 m_completeResolver.clear(); | 361 m_completeResolver.clear(); |
| 362 m_showResolver.clear(); | 362 m_showResolver.clear(); |
| 363 m_clientBinding.Close(); | 363 m_clientBinding.Close(); |
| 364 m_paymentProvider.reset(); | 364 m_paymentProvider.reset(); |
| 365 } | 365 } |
| 366 | 366 |
| 367 } // namespace blink | 367 } // namespace blink |
| OLD | NEW |