| 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_PUBLIC_BROWSER_PAYMENT_APP_PROVIDER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_PAYMENT_APP_PROVIDER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_PAYMENT_APP_PROVIDER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_PAYMENT_APP_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // This static function is actually implemented in PaymentAppProviderImpl.cc. | 26 // This static function is actually implemented in PaymentAppProviderImpl.cc. |
| 27 // Please see: content/browser/payments/payment_app_provider_impl.cc | 27 // Please see: content/browser/payments/payment_app_provider_impl.cc |
| 28 static PaymentAppProvider* GetInstance(); | 28 static PaymentAppProvider* GetInstance(); |
| 29 | 29 |
| 30 // The ManifestWithID is a pair of the service worker registration id and | 30 // The ManifestWithID is a pair of the service worker registration id and |
| 31 // the payment app manifest data associated with it. | 31 // the payment app manifest data associated with it. |
| 32 using ManifestWithID = | 32 using ManifestWithID = |
| 33 std::pair<int64_t, payments::mojom::PaymentAppManifestPtr>; | 33 std::pair<int64_t, payments::mojom::PaymentAppManifestPtr>; |
| 34 using Manifests = std::vector<ManifestWithID>; | 34 using Manifests = std::vector<ManifestWithID>; |
| 35 | 35 |
| 36 using Instruments = std::vector<payments::mojom::PaymentInstrumentPtr>; |
| 37 using PaymentApps = std::map<GURL, Instruments>; |
| 38 |
| 36 // TODO(zino): Consider to use base::OnceCallback instead of base::Callback. | 39 // TODO(zino): Consider to use base::OnceCallback instead of base::Callback. |
| 37 // Please see: http://crbug.com/704193 | 40 // Please see: http://crbug.com/704193 |
| 38 using GetAllManifestsCallback = base::Callback<void(Manifests)>; | 41 using GetAllManifestsCallback = base::Callback<void(Manifests)>; |
| 42 using GetAllPaymentAppsCallback = base::OnceCallback<void(PaymentApps)>; |
| 39 using InvokePaymentAppCallback = | 43 using InvokePaymentAppCallback = |
| 40 base::Callback<void(payments::mojom::PaymentAppResponsePtr)>; | 44 base::Callback<void(payments::mojom::PaymentAppResponsePtr)>; |
| 41 | 45 |
| 42 // Should be accessed only on the UI thread. | 46 // Should be accessed only on the UI thread. |
| 43 virtual void GetAllManifests(BrowserContext* browser_context, | 47 virtual void GetAllManifests(BrowserContext* browser_context, |
| 44 const GetAllManifestsCallback& callback) = 0; | 48 const GetAllManifestsCallback& callback) = 0; |
| 49 virtual void GetAllPaymentApps(BrowserContext* browser_context, |
| 50 GetAllPaymentAppsCallback callback) = 0; |
| 45 virtual void InvokePaymentApp( | 51 virtual void InvokePaymentApp( |
| 46 BrowserContext* browser_context, | 52 BrowserContext* browser_context, |
| 47 int64_t registration_id, | 53 int64_t registration_id, |
| 48 payments::mojom::PaymentAppRequestPtr app_request, | 54 payments::mojom::PaymentAppRequestPtr app_request, |
| 49 const InvokePaymentAppCallback& callback) = 0; | 55 const InvokePaymentAppCallback& callback) = 0; |
| 50 | 56 |
| 51 protected: | 57 protected: |
| 52 virtual ~PaymentAppProvider() {} | 58 virtual ~PaymentAppProvider() {} |
| 53 }; | 59 }; |
| 54 | 60 |
| 55 } // namespace content | 61 } // namespace content |
| 56 | 62 |
| 57 #endif // CONTENT_PUBLIC_BROWSER_PAYMENT_APP_PROVIDER_H_ | 63 #endif // CONTENT_PUBLIC_BROWSER_PAYMENT_APP_PROVIDER_H_ |
| OLD | NEW |