| 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/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/V8StringResource.h" | 10 #include "bindings/core/v8/V8StringResource.h" |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 | 517 |
| 518 // 2. If |document|'s browsing context is a top-level browsing context, then | 518 // 2. If |document|'s browsing context is a top-level browsing context, then |
| 519 // return true. | 519 // return true. |
| 520 if (frame->isMainFrame()) | 520 if (frame->isMainFrame()) |
| 521 return true; | 521 return true; |
| 522 | 522 |
| 523 // 3. If |document|'s browsing context has a browsing context container that | 523 // 3. If |document|'s browsing context has a browsing context container that |
| 524 // is an iframe element with an |allowpaymentrequest| attribute specified, and | 524 // is an iframe element with an |allowpaymentrequest| attribute specified, and |
| 525 // whose node document is allowed to use the feature indicated by | 525 // whose node document is allowed to use the feature indicated by |
| 526 // |allowpaymentrequest|, then return true. | 526 // |allowpaymentrequest|, then return true. |
| 527 HTMLFrameOwnerElement* ownerElement = toHTMLFrameOwnerElement(frame->owner()); | 527 if (frame->owner() && frame->owner()->allowPaymentRequest()) |
| 528 if (ownerElement && isHTMLIFrameElement(ownerElement)) { | 528 return allowedToUsePaymentRequest(frame->tree().parent()); |
| 529 HTMLIFrameElement* iframe = toHTMLIFrameElement(ownerElement); | |
| 530 if (HTMLIFrameElementPayments::from(*iframe).allowPaymentRequest(*iframe)) | |
| 531 return allowedToUsePaymentRequest(frame->tree().parent()); | |
| 532 } | |
| 533 | 529 |
| 534 // 4. Return false. | 530 // 4. Return false. |
| 535 return false; | 531 return false; |
| 536 } | 532 } |
| 537 | 533 |
| 538 } // namespace | 534 } // namespace |
| 539 | 535 |
| 540 PaymentRequest* PaymentRequest::create( | 536 PaymentRequest* PaymentRequest::create( |
| 541 ScriptState* scriptState, | 537 ScriptState* scriptState, |
| 542 const HeapVector<PaymentMethodData>& methodData, | 538 const HeapVector<PaymentMethodData>& methodData, |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 m_completeResolver.clear(); | 962 m_completeResolver.clear(); |
| 967 m_showResolver.clear(); | 963 m_showResolver.clear(); |
| 968 m_abortResolver.clear(); | 964 m_abortResolver.clear(); |
| 969 m_canMakePaymentResolver.clear(); | 965 m_canMakePaymentResolver.clear(); |
| 970 if (m_clientBinding.is_bound()) | 966 if (m_clientBinding.is_bound()) |
| 971 m_clientBinding.Close(); | 967 m_clientBinding.Close(); |
| 972 m_paymentProvider.reset(); | 968 m_paymentProvider.reset(); |
| 973 } | 969 } |
| 974 | 970 |
| 975 } // namespace blink | 971 } // namespace blink |
| OLD | NEW |