Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: content/public/browser/payment_app_provider.h

Issue 2873683002: PaymentHandler: Implement GetAllPaymentApps(). (Closed)
Patch Set: PaymentHandler: Implement GetAllPaymentApps(). Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory>
9 #include <utility> 10 #include <utility>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
13 #include "components/payments/mojom/payment_app.mojom.h" 14 #include "components/payments/mojom/payment_app.mojom.h"
14 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/public/browser/payment_instrument.h"
15 17
16 namespace content { 18 namespace content {
17 19
18 class BrowserContext; 20 class BrowserContext;
19 21
20 // This is providing the service worker based payment app related APIs to 22 // This is providing the service worker based payment app related APIs to
21 // Chrome layer. This class is a singleton, the instance of which can be 23 // Chrome layer. This class is a singleton, the instance of which can be
22 // retrieved using the static GetInstance() method. 24 // retrieved using the static GetInstance() method.
23 // All methods must be called on the UI thread. 25 // All methods must be called on the UI thread.
26 //
27 // Design Doc:
28 // https://docs.google.com/document/d/1rWsvKQAwIboN2ZDuYYAkfce8GF27twi4UHTt0hc byxQ/edit?usp=sharing
zino 2017/05/10 19:34:12 Done
24 class CONTENT_EXPORT PaymentAppProvider { 29 class CONTENT_EXPORT PaymentAppProvider {
25 public: 30 public:
26 // This static function is actually implemented in PaymentAppProviderImpl.cc. 31 // This static function is actually implemented in PaymentAppProviderImpl.cc.
27 // Please see: content/browser/payments/payment_app_provider_impl.cc 32 // Please see: content/browser/payments/payment_app_provider_impl.cc
28 static PaymentAppProvider* GetInstance(); 33 static PaymentAppProvider* GetInstance();
29 34
30 // The ManifestWithID is a pair of the service worker registration id and 35 // The ManifestWithID is a pair of the service worker registration id and
31 // the payment app manifest data associated with it. 36 // the payment app manifest data associated with it.
32 using ManifestWithID = 37 using ManifestWithID =
33 std::pair<int64_t, payments::mojom::PaymentAppManifestPtr>; 38 std::pair<int64_t, payments::mojom::PaymentAppManifestPtr>;
34 using Manifests = std::vector<ManifestWithID>; 39 using Manifests = std::vector<ManifestWithID>;
35 40
41 using Instruments = std::vector<std::unique_ptr<PaymentInstrument>>;
42 using PaymentApps = std::map<GURL, Instruments>;
43
36 // TODO(zino): Consider to use base::OnceCallback instead of base::Callback. 44 // TODO(zino): Consider to use base::OnceCallback instead of base::Callback.
37 // Please see: http://crbug.com/704193 45 // Please see: http://crbug.com/704193
38 using GetAllManifestsCallback = base::Callback<void(Manifests)>; 46 using GetAllManifestsCallback = base::Callback<void(Manifests)>;
47 using GetAllPaymentAppsCallback = base::OnceCallback<void(PaymentApps)>;
39 using InvokePaymentAppCallback = 48 using InvokePaymentAppCallback =
40 base::Callback<void(payments::mojom::PaymentAppResponsePtr)>; 49 base::Callback<void(payments::mojom::PaymentAppResponsePtr)>;
41 50
42 // Should be accessed only on the UI thread. 51 // Should be accessed only on the UI thread.
43 virtual void GetAllManifests(BrowserContext* browser_context, 52 virtual void GetAllManifests(BrowserContext* browser_context,
44 const GetAllManifestsCallback& callback) = 0; 53 const GetAllManifestsCallback& callback) = 0;
54 virtual void GetAllPaymentApps(BrowserContext* browser_context,
55 GetAllPaymentAppsCallback callback) = 0;
45 virtual void InvokePaymentApp( 56 virtual void InvokePaymentApp(
46 BrowserContext* browser_context, 57 BrowserContext* browser_context,
47 int64_t registration_id, 58 int64_t registration_id,
48 payments::mojom::PaymentAppRequestPtr app_request, 59 payments::mojom::PaymentAppRequestPtr app_request,
49 const InvokePaymentAppCallback& callback) = 0; 60 const InvokePaymentAppCallback& callback) = 0;
50 61
51 protected: 62 protected:
52 virtual ~PaymentAppProvider() {} 63 virtual ~PaymentAppProvider() {}
53 }; 64 };
54 65
55 } // namespace content 66 } // namespace content
56 67
57 #endif // CONTENT_PUBLIC_BROWSER_PAYMENT_APP_PROVIDER_H_ 68 #endif // CONTENT_PUBLIC_BROWSER_PAYMENT_APP_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698