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