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

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

Issue 2556433002: PaymentApp: Implement GetAllManifests() in PaymentAppContext. (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
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/payment_app.mojom.h" 13 #include "components/payments/payment_app.mojom.h"
14 #include "content/browser/payments/payment_app_database.h"
14 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
15 #include "content/public/browser/payment_app_context.h" 16 #include "content/public/browser/payment_app_context.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 class PaymentAppDatabase; 20 class PaymentAppDatabase;
20 class PaymentAppManager; 21 class PaymentAppManager;
21 class ServiceWorkerContextWrapper; 22 class ServiceWorkerContextWrapper;
22 23
23 // One instance of this exists per StoragePartition, and services multiple child 24 // One instance of this exists per StoragePartition, and services multiple child
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request); 60 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request);
60 61
61 // Called by PaymentAppManager objects so that they can 62 // Called by PaymentAppManager objects so that they can
62 // be deleted. Call on the IO thread. 63 // be deleted. Call on the IO thread.
63 void PaymentAppManagerHadConnectionError(PaymentAppManager* service); 64 void PaymentAppManagerHadConnectionError(PaymentAppManager* service);
64 65
65 // Should be accessed only on the IO thread. 66 // Should be accessed only on the IO thread.
66 PaymentAppDatabase* payment_app_database() const; 67 PaymentAppDatabase* payment_app_database() const;
67 68
68 // PaymentAppContext implementation: 69 // PaymentAppContext implementation:
70 // Should be accessed only on the UI thread.
69 void GetAllManifests(const GetAllManifestsCallback& callback) override; 71 void GetAllManifests(const GetAllManifestsCallback& callback) override;
70 72
71 protected:
72 friend class PaymentAppManagerTest;
73
74 private: 73 private:
74 friend class PaymentAppContentUnitTestBase;
75 friend class base::RefCountedThreadSafe<PaymentAppContextImpl>; 75 friend class base::RefCountedThreadSafe<PaymentAppContextImpl>;
76 ~PaymentAppContextImpl() override; 76 ~PaymentAppContextImpl() override;
77 77
78 void CreatePaymentAppDatabaseOnIO( 78 void CreatePaymentAppDatabaseOnIO(
79 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context); 79 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context);
80 80
81 void CreatePaymentAppManagerOnIO( 81 void CreatePaymentAppManagerOnIO(
82 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request); 82 mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request);
83 83
84 void ShutdownOnIO(); 84 void ShutdownOnIO();
85 void DidShutdown(); 85 void DidShutdown();
86 86
87 void GetAllManifestsOnIO(const GetAllManifestsCallback& callback);
88 void DidGetAllManifestsOnIO(const GetAllManifestsCallback& callback,
89 PaymentAppDatabase::Manifests manifests);
90
87 // Only accessed on the IO thread. 91 // Only accessed on the IO thread.
88 std::unique_ptr<PaymentAppDatabase> payment_app_database_; 92 std::unique_ptr<PaymentAppDatabase> payment_app_database_;
89 93
90 // The PaymentAppManagers are owned by this. They're either deleted during 94 // The PaymentAppManagers are owned by this. They're either deleted during
91 // ShutdownOnIO or when the channel is closed via 95 // ShutdownOnIO or when the channel is closed via
92 // PaymentAppManagerHadConnectionError. Only accessed on the IO thread. 96 // PaymentAppManagerHadConnectionError. Only accessed on the IO thread.
93 std::map<PaymentAppManager*, std::unique_ptr<PaymentAppManager>> 97 std::map<PaymentAppManager*, std::unique_ptr<PaymentAppManager>>
94 payment_app_managers_; 98 payment_app_managers_;
95 99
96 // Only accessed on the UI thread. 100 // Only accessed on the UI thread.
97 bool is_shutdown_; 101 bool is_shutdown_;
98 102
99 DISALLOW_COPY_AND_ASSIGN(PaymentAppContextImpl); 103 DISALLOW_COPY_AND_ASSIGN(PaymentAppContextImpl);
100 }; 104 };
101 105
102 } // namespace content 106 } // namespace content
103 107
104 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_ 108 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698