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

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

Issue 2497983002: PaymentApp: Implement PaymentAppManager.setManifest(). (Closed)
Patch Set: rebase Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/payments/payment-app-manager.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 wrapPersistent(resolver)))); 83 wrapPersistent(resolver))));
84 84
85 return promise; 85 return promise;
86 } 86 }
87 87
88 void PaymentAppManager::onSetManifest( 88 void PaymentAppManager::onSetManifest(
89 ScriptPromiseResolver* resolver, 89 ScriptPromiseResolver* resolver,
90 payments::mojom::blink::PaymentAppManifestError error) { 90 payments::mojom::blink::PaymentAppManifestError error) {
91 DCHECK(resolver); 91 DCHECK(resolver);
92 switch (error) { 92 switch (error) {
93 case payments::mojom::blink::PaymentAppManifestError::NONE:
94 resolver->resolve();
95 break;
93 case payments::mojom::blink::PaymentAppManifestError::NOT_IMPLEMENTED: 96 case payments::mojom::blink::PaymentAppManifestError::NOT_IMPLEMENTED:
94 resolver->reject( 97 resolver->reject(
95 DOMException::create(NotSupportedError, "Not implemented yet.")); 98 DOMException::create(NotSupportedError, "Not implemented yet."));
96 break; 99 break;
97 default: 100 case payments::mojom::blink::PaymentAppManifestError::NO_ACTIVE_WORKER:
98 NOTREACHED(); 101 resolver->reject(
102 DOMException::create(InvalidStateError, "No active service worker."));
103 break;
104 case payments::mojom::blink::PaymentAppManifestError::STORE_MANIFEST_FAILED:
105 resolver->reject(DOMException::create(
106 InvalidStateError, "Storing manifest data is failed."));
107 break;
99 } 108 }
100 } 109 }
101 110
102 DEFINE_TRACE(PaymentAppManager) { 111 DEFINE_TRACE(PaymentAppManager) {
103 visitor->trace(m_registration); 112 visitor->trace(m_registration);
104 ContextLifecycleObserver::trace(visitor); 113 ContextLifecycleObserver::trace(visitor);
105 } 114 }
106 115
107 PaymentAppManager::PaymentAppManager(ScriptState* scriptState, 116 PaymentAppManager::PaymentAppManager(ScriptState* scriptState,
108 ServiceWorkerRegistration* registration) 117 ServiceWorkerRegistration* registration)
(...skipping 13 matching lines...) Expand all
122 } 131 }
123 132
124 m_manager.reset(); 133 m_manager.reset();
125 } 134 }
126 135
127 void PaymentAppManager::contextDestroyed() { 136 void PaymentAppManager::contextDestroyed() {
128 m_manager.reset(); 137 m_manager.reset();
129 } 138 }
130 139
131 } // namespace blink 140 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/payments/payment-app-manager.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698