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

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

Issue 2565423002: Revert of PaymentApp: Introduce PaymentAppDatabase class. (Closed)
Patch Set: Created 4 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_
6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_
7
8 #include <map>
9 #include <memory>
10
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "components/payments/payment_app.mojom.h"
14 #include "content/browser/payments/payment_app_database.h"
15 #include "content/common/content_export.h"
16 #include "content/public/browser/payment_app_context.h"
17
18 namespace content {
19
20 class PaymentAppManager;
21
22 class CONTENT_EXPORT PaymentAppContextImpl
23 : NON_EXPORTED_BASE(public PaymentAppContext),
24 public base::RefCountedThreadSafe<PaymentAppContextImpl> {
25 public:
26 PaymentAppContextImpl();
27
28 // Init and Shutdown are for use on the UI thread when the
29 // StoragePartition is being setup and torn down.
30 void Init(scoped_refptr<ServiceWorkerContextWrapper> service_worker_context);
31
32 // Shutdown must be called before deleting this. Call on the UI thread.
33 void Shutdown();
34
35 // Create a PaymentAppManager that is owned by this. Call on the UI
36 // thread.
37 void CreateService(
38 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request);
39
40 // Called by PaymentAppManager objects so that they can
41 // be deleted. Call on the IO thread.
42 void ServiceHadConnectionError(PaymentAppManager* service);
43
44 PaymentAppDatabase* payment_app_database() const;
45
46 void GetAllManifests(const GetAllManifestsCallback& callback) override;
47
48 protected:
49 friend class base::RefCountedThreadSafe<PaymentAppContextImpl>;
50 friend class PaymentAppManagerTest;
51 virtual ~PaymentAppContextImpl();
52
53 private:
54 void CreatePaymentAppDatabaseOnIO(
55 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context);
56
57 void CreateServiceOnIOThread(
58 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request);
59
60 void ShutdownOnIO();
61
62 // Only accessed on the IO thread.
63 std::unique_ptr<PaymentAppDatabase> payment_app_database_;
64
65 // The services are owned by this. They're either deleted
66 // during ShutdownOnIO or when the channel is closed via
67 // ServiceHadConnectionError. Only accessed on the IO thread.
68 std::map<PaymentAppManager*, std::unique_ptr<PaymentAppManager>> services_;
69
70 DISALLOW_COPY_AND_ASSIGN(PaymentAppContextImpl);
71 };
72
73 } // namespace content
74
75 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/payments/payment_app_context.cc ('k') | content/browser/payments/payment_app_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698