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/PaymentAppManager.h" | 5 #include "modules/payments/PaymentAppManager.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
10 #include "modules/payments/PaymentAppManifest.h" | 10 #include "modules/payments/PaymentAppManifest.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 output.setEnabledMethods(enabledMethods); | 77 output.setEnabledMethods(enabledMethods); |
78 return output; | 78 return output; |
79 } | 79 } |
80 }; | 80 }; |
81 | 81 |
82 } // namespace mojo | 82 } // namespace mojo |
83 | 83 |
84 namespace blink { | 84 namespace blink { |
85 | 85 |
86 PaymentAppManager* PaymentAppManager::create( | 86 PaymentAppManager* PaymentAppManager::create( |
87 ScriptState* scriptState, | 87 ExecutionContext* executionContext, |
88 ServiceWorkerRegistration* registration) { | 88 ServiceWorkerRegistration* registration) { |
89 return new PaymentAppManager(scriptState, registration); | 89 return new PaymentAppManager(executionContext, registration); |
90 } | 90 } |
91 | 91 |
92 void PaymentAppManager::contextDestroyed() { | 92 void PaymentAppManager::contextDestroyed() { |
93 m_manager.reset(); | 93 m_manager.reset(); |
94 } | 94 } |
95 | 95 |
96 ScriptPromise PaymentAppManager::setManifest( | 96 ScriptPromise PaymentAppManager::setManifest( |
97 ScriptState* scriptState, | 97 ScriptState* scriptState, |
98 const PaymentAppManifest& manifest) { | 98 const PaymentAppManifest& manifest) { |
99 if (!m_manager) { | 99 if (!m_manager) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 wrapPersistent(this), wrapPersistent(resolver)))); | 131 wrapPersistent(this), wrapPersistent(resolver)))); |
132 | 132 |
133 return promise; | 133 return promise; |
134 } | 134 } |
135 | 135 |
136 DEFINE_TRACE(PaymentAppManager) { | 136 DEFINE_TRACE(PaymentAppManager) { |
137 visitor->trace(m_registration); | 137 visitor->trace(m_registration); |
138 ContextLifecycleObserver::trace(visitor); | 138 ContextLifecycleObserver::trace(visitor); |
139 } | 139 } |
140 | 140 |
141 PaymentAppManager::PaymentAppManager(ScriptState* scriptState, | 141 PaymentAppManager::PaymentAppManager(ExecutionContext* executionContext, |
142 ServiceWorkerRegistration* registration) | 142 ServiceWorkerRegistration* registration) |
143 : ContextLifecycleObserver(scriptState->getExecutionContext()), | 143 : ContextLifecycleObserver(executionContext), m_registration(registration) { |
144 m_registration(registration) { | |
145 DCHECK(registration); | 144 DCHECK(registration); |
146 Platform::current()->interfaceProvider()->getInterface( | 145 Platform::current()->interfaceProvider()->getInterface( |
147 mojo::GetProxy(&m_manager)); | 146 mojo::GetProxy(&m_manager)); |
148 | 147 |
149 m_manager.set_connection_error_handler(convertToBaseCallback(WTF::bind( | 148 m_manager.set_connection_error_handler(convertToBaseCallback(WTF::bind( |
150 &PaymentAppManager::onServiceConnectionError, wrapWeakPersistent(this)))); | 149 &PaymentAppManager::onServiceConnectionError, wrapWeakPersistent(this)))); |
151 } | 150 } |
152 | 151 |
153 void PaymentAppManager::onSetManifest( | 152 void PaymentAppManager::onSetManifest( |
154 ScriptPromiseResolver* resolver, | 153 ScriptPromiseResolver* resolver, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 199 |
201 void PaymentAppManager::onServiceConnectionError() { | 200 void PaymentAppManager::onServiceConnectionError() { |
202 if (!Platform::current()) { | 201 if (!Platform::current()) { |
203 return; | 202 return; |
204 } | 203 } |
205 | 204 |
206 m_manager.reset(); | 205 m_manager.reset(); |
207 } | 206 } |
208 | 207 |
209 } // namespace blink | 208 } // namespace blink |
OLD | NEW |