| 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" |
| 14 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 | 18 |
| 18 class PaymentAppContext; | 19 class PaymentAppContext; |
| 20 class ServiceWorkerRegistration; |
| 19 | 21 |
| 20 class CONTENT_EXPORT PaymentAppManager | 22 class CONTENT_EXPORT PaymentAppManager |
| 21 : public NON_EXPORTED_BASE(payments::mojom::PaymentAppManager) { | 23 : public NON_EXPORTED_BASE(payments::mojom::PaymentAppManager) { |
| 22 public: | 24 public: |
| 23 PaymentAppManager( | 25 PaymentAppManager( |
| 24 PaymentAppContext* payment_app_context, | 26 PaymentAppContext* payment_app_context, |
| 25 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request); | 27 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request); |
| 26 | 28 |
| 27 ~PaymentAppManager() override; | 29 ~PaymentAppManager() override; |
| 28 | 30 |
| 29 private: | 31 private: |
| 32 friend class PaymentAppManagerTest; |
| 30 // payments::mojom::PaymentAppManager methods: | 33 // payments::mojom::PaymentAppManager methods: |
| 31 void SetManifest(const std::string& scope, | 34 void SetManifest(const std::string& scope, |
| 32 payments::mojom::PaymentAppManifestPtr manifest, | 35 payments::mojom::PaymentAppManifestPtr manifest, |
| 33 const SetManifestCallback& callback) override; | 36 const SetManifestCallback& callback) override; |
| 37 void DidFindRegistrationToSetManifest( |
| 38 payments::mojom::PaymentAppManifestPtr manifest, |
| 39 const SetManifestCallback& callback, |
| 40 ServiceWorkerStatusCode status, |
| 41 scoped_refptr<ServiceWorkerRegistration> registration); |
| 42 void DidSetManifest(const SetManifestCallback& callback, |
| 43 ServiceWorkerStatusCode status); |
| 34 | 44 |
| 35 // Called when an error is detected on binding_. | 45 // Called when an error is detected on binding_. |
| 36 void OnConnectionError(); | 46 void OnConnectionError(); |
| 37 | 47 |
| 38 // payment_app_context_ owns this. | 48 // payment_app_context_ owns this. |
| 39 PaymentAppContext* payment_app_context_; | 49 PaymentAppContext* payment_app_context_; |
| 40 | 50 |
| 41 mojo::Binding<payments::mojom::PaymentAppManager> binding_; | 51 mojo::Binding<payments::mojom::PaymentAppManager> binding_; |
| 42 | 52 |
| 43 base::WeakPtrFactory<PaymentAppManager> weak_ptr_factory_; | 53 base::WeakPtrFactory<PaymentAppManager> weak_ptr_factory_; |
| 44 | 54 |
| 45 DISALLOW_COPY_AND_ASSIGN(PaymentAppManager); | 55 DISALLOW_COPY_AND_ASSIGN(PaymentAppManager); |
| 46 }; | 56 }; |
| 47 | 57 |
| 48 } // namespace content | 58 } // namespace content |
| 49 | 59 |
| 50 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_MANAGER_H_ | 60 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_MANAGER_H_ |
| OLD | NEW |