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

Side by Side Diff: content/browser/payments/payment_app_context.h

Issue 2497983002: PaymentApp: Implement PaymentAppManager.setManifest(). (Closed)
Patch Set: Created 4 years, 1 month 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_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_H_ 5 #ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_H_
6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_H_ 6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_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 15
16 namespace content { 16 namespace content {
17 17
18 class PaymentAppManager; 18 class PaymentAppManager;
19 class ServiceWorkerContextWrapper; 19 class ServiceWorkerContextWrapper;
20 20
21 class CONTENT_EXPORT PaymentAppContext 21 class CONTENT_EXPORT PaymentAppContext
22 : public base::RefCountedThreadSafe<PaymentAppContext> { 22 : public base::RefCountedThreadSafe<PaymentAppContext> {
23 public: 23 public:
24 PaymentAppContext(); 24 PaymentAppContext(
nhiroki 2016/11/15 02:32:18 explicit
zino 2016/11/15 17:57:37 Done.
25 25 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context);
26 // Init and Shutdown are for use on the UI thread when the
27 // StoragePartition is being setup and torn down.
28 void Init(scoped_refptr<ServiceWorkerContextWrapper> context);
29 26
30 // Shutdown must be called before deleting this. Call on the UI thread. 27 // Shutdown must be called before deleting this. Call on the UI thread.
31 void Shutdown(); 28 void Shutdown();
32 29
33 // Create a PaymentAppManager that is owned by this. Call on the UI 30 // Create a PaymentAppManager that is owned by this. Call on the UI
34 // thread. 31 // thread.
35 void CreateService( 32 void CreateService(
36 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request); 33 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request);
37 34
38 // Called by PaymentAppManager objects so that they can 35 // Called by PaymentAppManager objects so that they can
39 // be deleted. Call on the IO thread. 36 // be deleted. Call on the IO thread.
40 void ServiceHadConnectionError(PaymentAppManager* service); 37 void ServiceHadConnectionError(PaymentAppManager* service);
41 38
39 ServiceWorkerContextWrapper* service_worker_context() const;
40
42 protected: 41 protected:
43 friend class base::RefCountedThreadSafe<PaymentAppContext>; 42 friend class base::RefCountedThreadSafe<PaymentAppContext>;
43 friend class PaymentAppManagerTest;
44 virtual ~PaymentAppContext(); 44 virtual ~PaymentAppContext();
45 45
46 private: 46 private:
47 void CreateServiceOnIOThread( 47 void CreateServiceOnIOThread(
48 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request); 48 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request);
49 49
50 void ShutdownOnIO(); 50 void ShutdownOnIO();
51 51
52 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
53
52 // The services are owned by this. They're either deleted 54 // The services are owned by this. They're either deleted
53 // during ShutdownOnIO or when the channel is closed via 55 // during ShutdownOnIO or when the channel is closed via
54 // ServiceHadConnectionError. Only accessed on the IO thread. 56 // ServiceHadConnectionError. Only accessed on the IO thread.
55 std::map<PaymentAppManager*, std::unique_ptr<PaymentAppManager>> services_; 57 std::map<PaymentAppManager*, std::unique_ptr<PaymentAppManager>> services_;
56 58
57 DISALLOW_COPY_AND_ASSIGN(PaymentAppContext); 59 DISALLOW_COPY_AND_ASSIGN(PaymentAppContext);
58 }; 60 };
59 61
60 } // namespace content 62 } // namespace content
61 63
62 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_H_ 64 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698