OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_PAYMENTS_ANDROID_PAYMENT_MANIFEST_WEB_DATA_SERVICE_H_ |
| 6 #define COMPONENTS_PAYMENTS_ANDROID_PAYMENT_MANIFEST_WEB_DATA_SERVICE_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "components/payments/android/payment_method_manifest_table.h" |
| 10 #include "components/payments/android/web_app_manifest_section_table.h" |
| 11 #include "components/webdata/common/web_data_results.h" |
| 12 #include "components/webdata/common/web_data_service_base.h" |
| 13 #include "components/webdata/common/web_data_service_consumer.h" |
| 14 #include "components/webdata/common/web_database_service.h" |
| 15 |
| 16 namespace payments { |
| 17 |
| 18 // Web data service to read/write data in WebAppManifestSectionTable and |
| 19 // PaymentMethodManifestTable. |
| 20 class PaymentManifestWebDataService : public WebDataServiceBase { |
| 21 public: |
| 22 PaymentManifestWebDataService( |
| 23 scoped_refptr<WebDatabaseService> wdbs, |
| 24 const ProfileErrorCallback& callback, |
| 25 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread); |
| 26 |
| 27 // Adds the web app |manifest|. |
| 28 void AddPaymentWebAppManifest( |
| 29 std::vector<mojom::WebAppManifestSectionPtr> manifest); |
| 30 |
| 31 // Adds the |payment_method|'s manifest. |
| 32 void AddPaymentMethodManifest(const std::string& payment_method, |
| 33 std::vector<std::string> app_package_names); |
| 34 |
| 35 // Gets the |web_app|'s manifest. |
| 36 WebDataServiceBase::Handle GetPaymentWebAppManifest( |
| 37 const std::string& web_app, |
| 38 WebDataServiceConsumer* consumer); |
| 39 |
| 40 // Gets the |payment_method|'s manifest. |
| 41 WebDataServiceBase::Handle GetPaymentMethodManifest( |
| 42 const std::string& payment_method, |
| 43 WebDataServiceConsumer* consumer); |
| 44 |
| 45 private: |
| 46 ~PaymentManifestWebDataService() override; |
| 47 |
| 48 WebDatabase::State AddPaymentWebAppManifestImpl( |
| 49 const std::vector<mojom::WebAppManifestSectionPtr>& manifest, |
| 50 WebDatabase* db); |
| 51 WebDatabase::State AddPaymentMethodManifestImpl( |
| 52 const std::string& payment_method, |
| 53 const std::vector<std::string>& app_package_names, |
| 54 WebDatabase* db); |
| 55 |
| 56 std::unique_ptr<WDTypedResult> GetPaymentWebAppManifestImpl( |
| 57 const std::string& web_app, |
| 58 WebDatabase* db); |
| 59 std::unique_ptr<WDTypedResult> GetPaymentMethodManifestImpl( |
| 60 const std::string& payment_method, |
| 61 WebDatabase* db); |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(PaymentManifestWebDataService); |
| 64 }; |
| 65 |
| 66 } // namespace payments |
| 67 |
| 68 #endif // COMPONENTS_PAYMENTS_ANDROID_PAYMENT_MANIFEST_WEB_DATA_SERVICE_H_ |
OLD | NEW |