Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp

Issue 2790313004: Move ScriptState::domWindow() (Closed)
Patch Set: Rebase again Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 678
679 PaymentRequest::~PaymentRequest() {} 679 PaymentRequest::~PaymentRequest() {}
680 680
681 ScriptPromise PaymentRequest::show(ScriptState* scriptState) { 681 ScriptPromise PaymentRequest::show(ScriptState* scriptState) {
682 if (!m_paymentProvider.is_bound() || m_showResolver) { 682 if (!m_paymentProvider.is_bound() || m_showResolver) {
683 return ScriptPromise::rejectWithDOMException( 683 return ScriptPromise::rejectWithDOMException(
684 scriptState, 684 scriptState,
685 DOMException::create(InvalidStateError, "Already called show() once")); 685 DOMException::create(InvalidStateError, "Already called show() once"));
686 } 686 }
687 687
688 if (!scriptState->contextIsValid() || !scriptState->domWindow() || 688 if (!scriptState->contextIsValid() || !LocalDOMWindow::from(scriptState) ||
689 !scriptState->domWindow()->frame()) { 689 !LocalDOMWindow::from(scriptState)->frame()) {
690 return ScriptPromise::rejectWithDOMException( 690 return ScriptPromise::rejectWithDOMException(
691 scriptState, DOMException::create(InvalidStateError, 691 scriptState, DOMException::create(InvalidStateError,
692 "Cannot show the payment request")); 692 "Cannot show the payment request"));
693 } 693 }
694 694
695 m_paymentProvider->Show(); 695 m_paymentProvider->Show();
696 696
697 m_showResolver = ScriptPromiseResolver::create(scriptState); 697 m_showResolver = ScriptPromiseResolver::create(scriptState);
698 return m_showResolver->promise(); 698 return m_showResolver->promise();
699 } 699 }
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 m_completeResolver.clear(); 1072 m_completeResolver.clear();
1073 m_showResolver.clear(); 1073 m_showResolver.clear();
1074 m_abortResolver.clear(); 1074 m_abortResolver.clear();
1075 m_canMakePaymentResolver.clear(); 1075 m_canMakePaymentResolver.clear();
1076 if (m_clientBinding.is_bound()) 1076 if (m_clientBinding.is_bound())
1077 m_clientBinding.Close(); 1077 m_clientBinding.Close();
1078 m_paymentProvider.reset(); 1078 m_paymentProvider.reset();
1079 } 1079 }
1080 1080
1081 } // namespace blink 1081 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp ('k') | third_party/WebKit/Source/modules/sensor/Sensor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698