| 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_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_MANAGER_H_ | 6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "components/payments/payment_app.mojom.h" | 12 #include "components/payments/payment_app.mojom.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/common/service_worker/service_worker_status_code.h" | |
| 15 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
| 16 | 15 |
| 17 namespace content { | 16 namespace content { |
| 18 | 17 |
| 19 class PaymentAppContext; | 18 class PaymentAppContextImpl; |
| 20 class ServiceWorkerRegistration; | |
| 21 | 19 |
| 22 class CONTENT_EXPORT PaymentAppManager | 20 class CONTENT_EXPORT PaymentAppManager |
| 23 : public NON_EXPORTED_BASE(payments::mojom::PaymentAppManager) { | 21 : public NON_EXPORTED_BASE(payments::mojom::PaymentAppManager) { |
| 24 public: | 22 public: |
| 25 PaymentAppManager( | 23 PaymentAppManager( |
| 26 PaymentAppContext* payment_app_context, | 24 PaymentAppContextImpl* payment_app_context, |
| 27 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request); | 25 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request); |
| 28 | 26 |
| 29 ~PaymentAppManager() override; | 27 ~PaymentAppManager() override; |
| 30 | 28 |
| 31 private: | 29 private: |
| 32 friend class PaymentAppManagerTest; | 30 friend class PaymentAppManagerTest; |
| 33 | 31 |
| 34 // payments::mojom::PaymentAppManager methods: | 32 // payments::mojom::PaymentAppManager methods: |
| 35 void SetManifest(const std::string& scope, | 33 void SetManifest(const std::string& scope, |
| 36 payments::mojom::PaymentAppManifestPtr manifest, | 34 payments::mojom::PaymentAppManifestPtr manifest, |
| 37 const SetManifestCallback& callback) override; | 35 const SetManifestCallback& callback) override; |
| 38 void GetManifest(const std::string& scope, | 36 void GetManifest(const std::string& scope, |
| 39 const GetManifestCallback& callback) override; | 37 const GetManifestCallback& callback) override; |
| 40 | 38 |
| 41 // SetManifest callbacks | |
| 42 void DidFindRegistrationToSetManifest( | |
| 43 payments::mojom::PaymentAppManifestPtr manifest, | |
| 44 const SetManifestCallback& callback, | |
| 45 ServiceWorkerStatusCode status, | |
| 46 scoped_refptr<ServiceWorkerRegistration> registration); | |
| 47 void DidSetManifest(const SetManifestCallback& callback, | |
| 48 ServiceWorkerStatusCode status); | |
| 49 | |
| 50 // GetManifest callbacks | |
| 51 void DidFindRegistrationToGetManifest( | |
| 52 const GetManifestCallback& callback, | |
| 53 ServiceWorkerStatusCode status, | |
| 54 scoped_refptr<ServiceWorkerRegistration> registration); | |
| 55 void DidGetManifest(const GetManifestCallback& callback, | |
| 56 const std::vector<std::string>& data, | |
| 57 ServiceWorkerStatusCode status); | |
| 58 | |
| 59 // Called when an error is detected on binding_. | 39 // Called when an error is detected on binding_. |
| 60 void OnConnectionError(); | 40 void OnConnectionError(); |
| 61 | 41 |
| 62 // PaymentAppContext owns PaymentAppManager | 42 // PaymentAppContextImpl owns PaymentAppManager |
| 63 PaymentAppContext* payment_app_context_; | 43 PaymentAppContextImpl* payment_app_context_; |
| 64 | 44 |
| 65 mojo::Binding<payments::mojom::PaymentAppManager> binding_; | 45 mojo::Binding<payments::mojom::PaymentAppManager> binding_; |
| 66 | 46 |
| 67 base::WeakPtrFactory<PaymentAppManager> weak_ptr_factory_; | 47 base::WeakPtrFactory<PaymentAppManager> weak_ptr_factory_; |
| 68 | 48 |
| 69 DISALLOW_COPY_AND_ASSIGN(PaymentAppManager); | 49 DISALLOW_COPY_AND_ASSIGN(PaymentAppManager); |
| 70 }; | 50 }; |
| 71 | 51 |
| 72 } // namespace content | 52 } // namespace content |
| 73 | 53 |
| 74 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_MANAGER_H_ | 54 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_MANAGER_H_ |
| OLD | NEW |