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_CONTEXT_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_ |
6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_ | 6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "components/payments/mojom/payment_app.mojom.h" | 13 #include "components/payments/mojom/payment_app.mojom.h" |
14 #include "content/browser/payments/payment_app_database.h" | 14 #include "content/browser/payments/payment_app_database.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 | 16 |
| 17 namespace service_manager { |
| 18 struct BindSourceInfo; |
| 19 } |
| 20 |
17 namespace content { | 21 namespace content { |
18 | 22 |
19 class PaymentAppDatabase; | 23 class PaymentAppDatabase; |
20 class PaymentManager; | 24 class PaymentManager; |
21 class ServiceWorkerContextWrapper; | 25 class ServiceWorkerContextWrapper; |
22 | 26 |
23 // One instance of this exists per StoragePartition, and services multiple child | 27 // One instance of this exists per StoragePartition, and services multiple child |
24 // processes/origins. Most logic is delegated to the owned PaymentAppDatabase | 28 // processes/origins. Most logic is delegated to the owned PaymentAppDatabase |
25 // instance, which is only accessed on the IO thread. | 29 // instance, which is only accessed on the IO thread. |
26 // | 30 // |
(...skipping 20 matching lines...) Expand all Loading... |
47 | 51 |
48 // Init and Shutdown are for use on the UI thread when the | 52 // Init and Shutdown are for use on the UI thread when the |
49 // StoragePartition is being setup and torn down. | 53 // StoragePartition is being setup and torn down. |
50 void Init(scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); | 54 void Init(scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); |
51 | 55 |
52 // Shutdown must be called before deleting this. Call on the UI thread. | 56 // Shutdown must be called before deleting this. Call on the UI thread. |
53 void Shutdown(); | 57 void Shutdown(); |
54 | 58 |
55 // Create a PaymentManager that is owned by this. Call on the UI | 59 // Create a PaymentManager that is owned by this. Call on the UI |
56 // thread. | 60 // thread. |
57 void CreatePaymentManager( | 61 void CreatePaymentManager(const service_manager::BindSourceInfo& source_info, |
58 mojo::InterfaceRequest<payments::mojom::PaymentManager> request); | 62 payments::mojom::PaymentManagerRequest request); |
59 | 63 |
60 // Called by PaymentManager objects so that they can | 64 // Called by PaymentManager objects so that they can |
61 // be deleted. Call on the IO thread. | 65 // be deleted. Call on the IO thread. |
62 void PaymentManagerHadConnectionError(PaymentManager* service); | 66 void PaymentManagerHadConnectionError(PaymentManager* service); |
63 | 67 |
64 // Should be accessed only on the IO thread. | 68 // Should be accessed only on the IO thread. |
65 PaymentAppDatabase* payment_app_database() const; | 69 PaymentAppDatabase* payment_app_database() const; |
66 | 70 |
67 private: | 71 private: |
68 friend class PaymentAppContentUnitTestBase; | 72 friend class PaymentAppContentUnitTestBase; |
(...skipping 19 matching lines...) Expand all Loading... |
88 | 92 |
89 // Only accessed on the UI thread. | 93 // Only accessed on the UI thread. |
90 bool is_shutdown_; | 94 bool is_shutdown_; |
91 | 95 |
92 DISALLOW_COPY_AND_ASSIGN(PaymentAppContextImpl); | 96 DISALLOW_COPY_AND_ASSIGN(PaymentAppContextImpl); |
93 }; | 97 }; |
94 | 98 |
95 } // namespace content | 99 } // namespace content |
96 | 100 |
97 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_ | 101 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_ |
OLD | NEW |