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