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_H_ | 5 #ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_ |
6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_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/payment_app.mojom.h" | 13 #include "components/payments/payment_app.mojom.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/public/browser/payment_app_context.h" | |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 class PaymentAppManager; | 19 class PaymentAppManager; |
19 class ServiceWorkerContextWrapper; | 20 class ServiceWorkerContextWrapper; |
20 | 21 |
21 class CONTENT_EXPORT PaymentAppContext | 22 class CONTENT_EXPORT PaymentAppContextImpl |
22 : public base::RefCountedThreadSafe<PaymentAppContext> { | 23 : NON_EXPORTED_BASE(public PaymentAppContext), |
24 public base::RefCountedThreadSafe<PaymentAppContextImpl> { | |
please use gerrit instead
2016/12/14 16:50:05
The pure interface PaymentAppContext should be lis
zino
2016/12/14 17:20:19
Done.
| |
23 public: | 25 public: |
24 explicit PaymentAppContext( | 26 explicit PaymentAppContextImpl( |
25 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); | 27 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); |
26 | 28 |
27 // Shutdown must be called before deleting this. Call on the UI thread. | 29 // Shutdown must be called before deleting this. Call on the UI thread. |
28 void Shutdown(); | 30 void Shutdown(); |
29 | 31 |
30 // Create a PaymentAppManager that is owned by this. Call on the UI | 32 // Create a PaymentAppManager that is owned by this. Call on the UI |
31 // thread. | 33 // thread. |
32 void CreateService( | 34 void CreateService( |
33 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request); | 35 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request); |
34 | 36 |
35 // Called by PaymentAppManager objects so that they can | 37 // Called by PaymentAppManager objects so that they can |
36 // be deleted. Call on the IO thread. | 38 // be deleted. Call on the IO thread. |
37 void ServiceHadConnectionError(PaymentAppManager* service); | 39 void ServiceHadConnectionError(PaymentAppManager* service); |
38 | 40 |
39 ServiceWorkerContextWrapper* service_worker_context() const; | 41 ServiceWorkerContextWrapper* service_worker_context() const; |
40 | 42 |
please use gerrit instead
2016/12/14 16:50:05
// PaymentAppContext implementation:
zino
2016/12/14 17:20:19
Done.
| |
43 void GetAllManifests(const GetAllManifestsCallback& callback) override; | |
44 | |
41 protected: | 45 protected: |
42 friend class base::RefCountedThreadSafe<PaymentAppContext>; | 46 friend class base::RefCountedThreadSafe<PaymentAppContextImpl>; |
43 friend class PaymentAppManagerTest; | 47 friend class PaymentAppManagerTest; |
44 virtual ~PaymentAppContext(); | 48 virtual ~PaymentAppContextImpl(); |
please use gerrit instead
2016/12/14 16:50:05
override instead of virtual
Can you make it priva
zino
2016/12/14 17:20:19
Done.
| |
45 | 49 |
46 private: | 50 private: |
47 void CreateServiceOnIOThread( | 51 void CreateServiceOnIOThread( |
48 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request); | 52 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request); |
49 | 53 |
50 void ShutdownOnIO(); | 54 void ShutdownOnIO(); |
51 | 55 |
52 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | 56 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
53 | 57 |
54 // The services are owned by this. They're either deleted | 58 // The services are owned by this. They're either deleted |
55 // during ShutdownOnIO or when the channel is closed via | 59 // during ShutdownOnIO or when the channel is closed via |
56 // ServiceHadConnectionError. Only accessed on the IO thread. | 60 // ServiceHadConnectionError. Only accessed on the IO thread. |
57 std::map<PaymentAppManager*, std::unique_ptr<PaymentAppManager>> services_; | 61 std::map<PaymentAppManager*, std::unique_ptr<PaymentAppManager>> services_; |
58 | 62 |
59 DISALLOW_COPY_AND_ASSIGN(PaymentAppContext); | 63 DISALLOW_COPY_AND_ASSIGN(PaymentAppContextImpl); |
60 }; | 64 }; |
61 | 65 |
62 } // namespace content | 66 } // namespace content |
63 | 67 |
64 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_H_ | 68 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_ |
OLD | NEW |