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

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

Issue 2893823004: [Payments] Implement openWindow for service worker based payment handler (Closed)
Patch Set: address comments Created 3 years, 6 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/PaymentRequestEvent.h" 5 #include "modules/payments/PaymentRequestEvent.h"
6 6
7 #include "modules/serviceworkers/RespondWithObserver.h" 7 #include "modules/serviceworkers/RespondWithObserver.h"
8 #include "modules/serviceworkers/ServiceWorkerClients.h"
9 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h"
8 #include "platform/wtf/text/AtomicString.h" 10 #include "platform/wtf/text/AtomicString.h"
9 11
10 namespace blink { 12 namespace blink {
11 13
12 PaymentRequestEvent* PaymentRequestEvent::Create( 14 PaymentRequestEvent* PaymentRequestEvent::Create(
13 const AtomicString& type, 15 const AtomicString& type,
14 const PaymentAppRequest& app_request, 16 const PaymentAppRequest& app_request,
15 RespondWithObserver* respond_with_observer, 17 RespondWithObserver* respond_with_observer,
16 WaitUntilObserver* wait_until_observer) { 18 WaitUntilObserver* wait_until_observer) {
17 return new PaymentRequestEvent(type, app_request, respond_with_observer, 19 return new PaymentRequestEvent(type, app_request, respond_with_observer,
(...skipping 28 matching lines...) Expand all
46 48
47 const HeapVector<PaymentDetailsModifier>& PaymentRequestEvent::modifiers() 49 const HeapVector<PaymentDetailsModifier>& PaymentRequestEvent::modifiers()
48 const { 50 const {
49 return modifiers_; 51 return modifiers_;
50 } 52 }
51 53
52 const String& PaymentRequestEvent::instrumentKey() const { 54 const String& PaymentRequestEvent::instrumentKey() const {
53 return instrument_key_; 55 return instrument_key_;
54 } 56 }
55 57
58 ScriptPromise PaymentRequestEvent::openWindow(ScriptState* script_state,
59 const String& url) {
60 return ToServiceWorkerGlobalScope(ExecutionContext::From(script_state))
zino 2017/05/25 17:02:42 If the origin of the url is not the same as the SW
gogerald1 2017/05/29 22:13:16 Done.
61 ->clients()
62 ->openWindow(script_state, top_level_origin_, url);
63 }
64
56 void PaymentRequestEvent::respondWith(ScriptState* script_state, 65 void PaymentRequestEvent::respondWith(ScriptState* script_state,
57 ScriptPromise script_promise, 66 ScriptPromise script_promise,
58 ExceptionState& exception_state) { 67 ExceptionState& exception_state) {
59 stopImmediatePropagation(); 68 stopImmediatePropagation();
60 if (observer_) { 69 if (observer_) {
61 observer_->RespondWith(script_state, script_promise, exception_state); 70 observer_->RespondWith(script_state, script_promise, exception_state);
62 } 71 }
63 } 72 }
64 73
65 DEFINE_TRACE(PaymentRequestEvent) { 74 DEFINE_TRACE(PaymentRequestEvent) {
(...skipping 12 matching lines...) Expand all
78 top_level_origin_(app_request.topLevelOrigin()), 87 top_level_origin_(app_request.topLevelOrigin()),
79 payment_request_origin_(app_request.paymentRequestOrigin()), 88 payment_request_origin_(app_request.paymentRequestOrigin()),
80 payment_request_id_(app_request.paymentRequestId()), 89 payment_request_id_(app_request.paymentRequestId()),
81 method_data_(std::move(app_request.methodData())), 90 method_data_(std::move(app_request.methodData())),
82 total_(app_request.total()), 91 total_(app_request.total()),
83 modifiers_(app_request.modifiers()), 92 modifiers_(app_request.modifiers()),
84 instrument_key_(app_request.instrumentKey()), 93 instrument_key_(app_request.instrumentKey()),
85 observer_(respond_with_observer) {} 94 observer_(respond_with_observer) {}
86 95
87 } // namespace blink 96 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698