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 19 matching lines...) Expand all Loading... |
30 payments::mojom::PaymentAppManifestError)>; | 30 payments::mojom::PaymentAppManifestError)>; |
31 using ManifestWithID = | 31 using ManifestWithID = |
32 std::pair<int64_t, payments::mojom::PaymentAppManifestPtr>; | 32 std::pair<int64_t, payments::mojom::PaymentAppManifestPtr>; |
33 using Manifests = std::vector<ManifestWithID>; | 33 using Manifests = std::vector<ManifestWithID>; |
34 using ReadAllManifestsCallback = base::Callback<void(Manifests)>; | 34 using ReadAllManifestsCallback = base::Callback<void(Manifests)>; |
35 using DeletePaymentInstrumentCallback = | 35 using DeletePaymentInstrumentCallback = |
36 base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; | 36 base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; |
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 HasPaymentInstrumentCallback = |
| 41 base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; |
40 using WritePaymentInstrumentCallback = | 42 using WritePaymentInstrumentCallback = |
41 base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; | 43 base::OnceCallback<void(payments::mojom::PaymentHandlerStatus)>; |
42 | 44 |
43 explicit PaymentAppDatabase( | 45 explicit PaymentAppDatabase( |
44 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); | 46 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); |
45 ~PaymentAppDatabase(); | 47 ~PaymentAppDatabase(); |
46 | 48 |
47 void WriteManifest(const GURL& scope, | 49 void WriteManifest(const GURL& scope, |
48 payments::mojom::PaymentAppManifestPtr manifest, | 50 payments::mojom::PaymentAppManifestPtr manifest, |
49 const WriteManifestCallback& callback); | 51 const WriteManifestCallback& callback); |
50 void ReadManifest(const GURL& scope, const ReadManifestCallback& callback); | 52 void ReadManifest(const GURL& scope, const ReadManifestCallback& callback); |
51 void ReadAllManifests(const ReadAllManifestsCallback& callback); | 53 void ReadAllManifests(const ReadAllManifestsCallback& callback); |
52 void DeletePaymentInstrument(const GURL& scope, | 54 void DeletePaymentInstrument(const GURL& scope, |
53 const std::string& instrument_key, | 55 const std::string& instrument_key, |
54 DeletePaymentInstrumentCallback callback); | 56 DeletePaymentInstrumentCallback callback); |
55 void ReadPaymentInstrument(const GURL& scope, | 57 void ReadPaymentInstrument(const GURL& scope, |
56 const std::string& instrument_key, | 58 const std::string& instrument_key, |
57 ReadPaymentInstrumentCallback callback); | 59 ReadPaymentInstrumentCallback callback); |
| 60 void HasPaymentInstrument(const GURL& scope, |
| 61 const std::string& instrument_key, |
| 62 HasPaymentInstrumentCallback callback); |
58 void WritePaymentInstrument(const GURL& scope, | 63 void WritePaymentInstrument(const GURL& scope, |
59 const std::string& instrument_key, | 64 const std::string& instrument_key, |
60 payments::mojom::PaymentInstrumentPtr instrument, | 65 payments::mojom::PaymentInstrumentPtr instrument, |
61 WritePaymentInstrumentCallback callback); | 66 WritePaymentInstrumentCallback callback); |
62 | 67 |
63 private: | 68 private: |
64 // WriteManifest callbacks | 69 // WriteManifest callbacks |
65 void DidFindRegistrationToWriteManifest( | 70 void DidFindRegistrationToWriteManifest( |
66 payments::mojom::PaymentAppManifestPtr manifest, | 71 payments::mojom::PaymentAppManifestPtr manifest, |
67 const WriteManifestCallback& callback, | 72 const WriteManifestCallback& callback, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // ReadPaymentInstrument callbacks | 107 // ReadPaymentInstrument callbacks |
103 void DidFindRegistrationToReadPaymentInstrument( | 108 void DidFindRegistrationToReadPaymentInstrument( |
104 const std::string& instrument_key, | 109 const std::string& instrument_key, |
105 ReadPaymentInstrumentCallback callback, | 110 ReadPaymentInstrumentCallback callback, |
106 ServiceWorkerStatusCode status, | 111 ServiceWorkerStatusCode status, |
107 scoped_refptr<ServiceWorkerRegistration> registration); | 112 scoped_refptr<ServiceWorkerRegistration> registration); |
108 void DidReadPaymentInstrument(ReadPaymentInstrumentCallback callback, | 113 void DidReadPaymentInstrument(ReadPaymentInstrumentCallback callback, |
109 const std::vector<std::string>& data, | 114 const std::vector<std::string>& data, |
110 ServiceWorkerStatusCode status); | 115 ServiceWorkerStatusCode status); |
111 | 116 |
| 117 // HasPaymentInstrument callbacks |
| 118 void DidFindRegistrationToHasPaymentInstrument( |
| 119 const std::string& instrument_key, |
| 120 HasPaymentInstrumentCallback callback, |
| 121 ServiceWorkerStatusCode status, |
| 122 scoped_refptr<ServiceWorkerRegistration> registration); |
| 123 void DidHasPaymentInstrument(int64_t registration_id, |
| 124 const std::string& instrument_key, |
| 125 DeletePaymentInstrumentCallback callback, |
| 126 const std::vector<std::string>& data, |
| 127 ServiceWorkerStatusCode status); |
| 128 |
112 // WritePaymentInstrument callbacks | 129 // WritePaymentInstrument callbacks |
113 void DidFindRegistrationToWritePaymentInstrument( | 130 void DidFindRegistrationToWritePaymentInstrument( |
114 const std::string& instrument_key, | 131 const std::string& instrument_key, |
115 payments::mojom::PaymentInstrumentPtr instrument, | 132 payments::mojom::PaymentInstrumentPtr instrument, |
116 WritePaymentInstrumentCallback callback, | 133 WritePaymentInstrumentCallback callback, |
117 ServiceWorkerStatusCode status, | 134 ServiceWorkerStatusCode status, |
118 scoped_refptr<ServiceWorkerRegistration> registration); | 135 scoped_refptr<ServiceWorkerRegistration> registration); |
119 void DidWritePaymentInstrument(WritePaymentInstrumentCallback callback, | 136 void DidWritePaymentInstrument(WritePaymentInstrumentCallback callback, |
120 ServiceWorkerStatusCode status); | 137 ServiceWorkerStatusCode status); |
121 | 138 |
122 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | 139 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
123 base::WeakPtrFactory<PaymentAppDatabase> weak_ptr_factory_; | 140 base::WeakPtrFactory<PaymentAppDatabase> weak_ptr_factory_; |
124 | 141 |
125 DISALLOW_COPY_AND_ASSIGN(PaymentAppDatabase); | 142 DISALLOW_COPY_AND_ASSIGN(PaymentAppDatabase); |
126 }; | 143 }; |
127 | 144 |
128 } // namespace content | 145 } // namespace content |
129 | 146 |
130 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_ | 147 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_ |
OLD | NEW |