| 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 | 475 |
| 476 // 2. If |document|'s browsing context is a top-level browsing context, then | 476 // 2. If |document|'s browsing context is a top-level browsing context, then |
| 477 // return true. | 477 // return true. |
| 478 if (frame->isMainFrame()) | 478 if (frame->isMainFrame()) |
| 479 return true; | 479 return true; |
| 480 | 480 |
| 481 // 3. If |document|'s browsing context has a browsing context container that | 481 // 3. If |document|'s browsing context has a browsing context container that |
| 482 // is an iframe element with an |allowpaymentrequest| attribute specified, and | 482 // is an iframe element with an |allowpaymentrequest| attribute specified, and |
| 483 // whose node document is allowed to use the feature indicated by | 483 // whose node document is allowed to use the feature indicated by |
| 484 // |allowpaymentrequest|, then return true. | 484 // |allowpaymentrequest|, then return true. |
| 485 HTMLFrameOwnerElement* ownerElement = toHTMLFrameOwnerElement(frame->owner()); | 485 if (frame->owner() && frame->owner()->allowPaymentRequest()) |
| 486 if (ownerElement && isHTMLIFrameElement(ownerElement)) { | 486 return allowedToUsePaymentRequest(frame->tree().parent()); |
| 487 HTMLIFrameElement* iframe = toHTMLIFrameElement(ownerElement); | |
| 488 if (HTMLIFrameElementPayments::from(*iframe).allowPaymentRequest(*iframe)) | |
| 489 return allowedToUsePaymentRequest(frame->tree().parent()); | |
| 490 } | |
| 491 | 487 |
| 492 // 4. Return false. | 488 // 4. Return false. |
| 493 return false; | 489 return false; |
| 494 } | 490 } |
| 495 | 491 |
| 496 } // namespace | 492 } // namespace |
| 497 | 493 |
| 498 PaymentRequest* PaymentRequest::create( | 494 PaymentRequest* PaymentRequest::create( |
| 499 Document& document, | 495 Document& document, |
| 500 const HeapVector<PaymentMethodData>& methodData, | 496 const HeapVector<PaymentMethodData>& methodData, |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 m_completeResolver.clear(); | 912 m_completeResolver.clear(); |
| 917 m_showResolver.clear(); | 913 m_showResolver.clear(); |
| 918 m_abortResolver.clear(); | 914 m_abortResolver.clear(); |
| 919 m_canMakePaymentResolver.clear(); | 915 m_canMakePaymentResolver.clear(); |
| 920 if (m_clientBinding.is_bound()) | 916 if (m_clientBinding.is_bound()) |
| 921 m_clientBinding.Close(); | 917 m_clientBinding.Close(); |
| 922 m_paymentProvider.reset(); | 918 m_paymentProvider.reset(); |
| 923 } | 919 } |
| 924 | 920 |
| 925 } // namespace blink | 921 } // namespace blink |
| OLD | NEW |