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 #ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_ | 5 #ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_ |
6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_ | 6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 using ReadPaymentInstrumentCallback = | 37 using ReadPaymentInstrumentCallback = |
38 base::OnceCallback<void(payments::mojom::PaymentInstrumentPtr, | 38 base::OnceCallback<void(payments::mojom::PaymentInstrumentPtr, |
39 payments::mojom::PaymentHandlerStatus)>; | 39 payments::mojom::PaymentHandlerStatus)>; |
40 using KeysOfPaymentInstrumentsCallback = | 40 using KeysOfPaymentInstrumentsCallback = |
41 base::OnceCallback<void(const std::vector<std::string>&, | 41 base::OnceCallback<void(const std::vector<std::string>&, |
42 payments::mojom::PaymentHandlerStatus)>; | 42 payments::mojom::PaymentHandlerStatus)>; |
43 using HasPaymentInstrumentCallback = | 43 using HasPaymentInstrumentCallback = |
44 base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; | 44 base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; |
45 using WritePaymentInstrumentCallback = | 45 using WritePaymentInstrumentCallback = |
46 base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; | 46 base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; |
| 47 using ClearPaymentInstrumentsCallback = |
| 48 base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; |
47 | 49 |
48 explicit PaymentAppDatabase( | 50 explicit PaymentAppDatabase( |
49 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); | 51 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); |
50 ~PaymentAppDatabase(); | 52 ~PaymentAppDatabase(); |
51 | 53 |
52 void WriteManifest(const GURL& scope, | 54 void WriteManifest(const GURL& scope, |
53 payments::mojom::PaymentAppManifestPtr manifest, | 55 payments::mojom::PaymentAppManifestPtr manifest, |
54 const WriteManifestCallback& callback); | 56 const WriteManifestCallback& callback); |
55 void ReadManifest(const GURL& scope, const ReadManifestCallback& callback); | 57 void ReadManifest(const GURL& scope, const ReadManifestCallback& callback); |
56 void ReadAllManifests(const ReadAllManifestsCallback& callback); | 58 void ReadAllManifests(const ReadAllManifestsCallback& callback); |
57 void DeletePaymentInstrument(const GURL& scope, | 59 void DeletePaymentInstrument(const GURL& scope, |
58 const std::string& instrument_key, | 60 const std::string& instrument_key, |
59 DeletePaymentInstrumentCallback callback); | 61 DeletePaymentInstrumentCallback callback); |
60 void ReadPaymentInstrument(const GURL& scope, | 62 void ReadPaymentInstrument(const GURL& scope, |
61 const std::string& instrument_key, | 63 const std::string& instrument_key, |
62 ReadPaymentInstrumentCallback callback); | 64 ReadPaymentInstrumentCallback callback); |
63 void KeysOfPaymentInstruments(const GURL& scope, | 65 void KeysOfPaymentInstruments(const GURL& scope, |
64 KeysOfPaymentInstrumentsCallback callback); | 66 KeysOfPaymentInstrumentsCallback callback); |
65 void HasPaymentInstrument(const GURL& scope, | 67 void HasPaymentInstrument(const GURL& scope, |
66 const std::string& instrument_key, | 68 const std::string& instrument_key, |
67 HasPaymentInstrumentCallback callback); | 69 HasPaymentInstrumentCallback callback); |
68 void WritePaymentInstrument(const GURL& scope, | 70 void WritePaymentInstrument(const GURL& scope, |
69 const std::string& instrument_key, | 71 const std::string& instrument_key, |
70 payments::mojom::PaymentInstrumentPtr instrument, | 72 payments::mojom::PaymentInstrumentPtr instrument, |
71 WritePaymentInstrumentCallback callback); | 73 WritePaymentInstrumentCallback callback); |
| 74 void ClearPaymentInstruments(const GURL& scope, |
| 75 ClearPaymentInstrumentsCallback callback); |
72 | 76 |
73 private: | 77 private: |
74 // WriteManifest callbacks | 78 // WriteManifest callbacks |
75 void DidFindRegistrationToWriteManifest( | 79 void DidFindRegistrationToWriteManifest( |
76 payments::mojom::PaymentAppManifestPtr manifest, | 80 payments::mojom::PaymentAppManifestPtr manifest, |
77 const WriteManifestCallback& callback, | 81 const WriteManifestCallback& callback, |
78 ServiceWorkerStatusCode status, | 82 ServiceWorkerStatusCode status, |
79 scoped_refptr<ServiceWorkerRegistration> registration); | 83 scoped_refptr<ServiceWorkerRegistration> registration); |
80 void DidWriteManifest(const WriteManifestCallback& callback, | 84 void DidWriteManifest(const WriteManifestCallback& callback, |
81 ServiceWorkerStatusCode status); | 85 ServiceWorkerStatusCode status); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // WritePaymentInstrument callbacks | 147 // WritePaymentInstrument callbacks |
144 void DidFindRegistrationToWritePaymentInstrument( | 148 void DidFindRegistrationToWritePaymentInstrument( |
145 const std::string& instrument_key, | 149 const std::string& instrument_key, |
146 payments::mojom::PaymentInstrumentPtr instrument, | 150 payments::mojom::PaymentInstrumentPtr instrument, |
147 WritePaymentInstrumentCallback callback, | 151 WritePaymentInstrumentCallback callback, |
148 ServiceWorkerStatusCode status, | 152 ServiceWorkerStatusCode status, |
149 scoped_refptr<ServiceWorkerRegistration> registration); | 153 scoped_refptr<ServiceWorkerRegistration> registration); |
150 void DidWritePaymentInstrument(WritePaymentInstrumentCallback callback, | 154 void DidWritePaymentInstrument(WritePaymentInstrumentCallback callback, |
151 ServiceWorkerStatusCode status); | 155 ServiceWorkerStatusCode status); |
152 | 156 |
| 157 // ClearPaymentInstruments callbacks |
| 158 void DidFindRegistrationToClearPaymentInstruments( |
| 159 const GURL& scope, |
| 160 ClearPaymentInstrumentsCallback callback, |
| 161 ServiceWorkerStatusCode status, |
| 162 scoped_refptr<ServiceWorkerRegistration> registration); |
| 163 void DidGetKeysToClearPaymentInstruments( |
| 164 int64_t registration_id, |
| 165 ClearPaymentInstrumentsCallback callback, |
| 166 const std::vector<std::string>& keys, |
| 167 payments::mojom::PaymentHandlerStatus status); |
| 168 void DidClearPaymentInstruments(ClearPaymentInstrumentsCallback callback, |
| 169 ServiceWorkerStatusCode status); |
| 170 |
153 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | 171 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
154 base::WeakPtrFactory<PaymentAppDatabase> weak_ptr_factory_; | 172 base::WeakPtrFactory<PaymentAppDatabase> weak_ptr_factory_; |
155 | 173 |
156 DISALLOW_COPY_AND_ASSIGN(PaymentAppDatabase); | 174 DISALLOW_COPY_AND_ASSIGN(PaymentAppDatabase); |
157 }; | 175 }; |
158 | 176 |
159 } // namespace content | 177 } // namespace content |
160 | 178 |
161 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_ | 179 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_ |
OLD | NEW |