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

Unified Diff: content/browser/payments/payment_app_context_impl.h

Issue 2560293002: PaymentApp: Introduce PaymentAppDatabase class. (Closed)
Patch Set: PaymentApp: Introduce PaymentAppDatabase class. 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/payments/payment_app_context_impl.h
diff --git a/content/browser/payments/payment_app_context.h b/content/browser/payments/payment_app_context_impl.h
similarity index 56%
rename from content/browser/payments/payment_app_context.h
rename to content/browser/payments/payment_app_context_impl.h
index 3572a8b892bd74ad80210fc5872f9013950e2545..79a85a68327da578064acfbd98a5e4c91d736170 100644
--- a/content/browser/payments/payment_app_context.h
+++ b/content/browser/payments/payment_app_context_impl.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_H_
-#define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_H_
+#ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_
+#define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_
#include <map>
#include <memory>
@@ -11,18 +11,23 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "components/payments/payment_app.mojom.h"
+#include "content/browser/payments/payment_app_database.h"
#include "content/common/content_export.h"
+#include "content/public/browser/payment_app_context.h"
namespace content {
class PaymentAppManager;
-class ServiceWorkerContextWrapper;
-class CONTENT_EXPORT PaymentAppContext
- : public base::RefCountedThreadSafe<PaymentAppContext> {
+class CONTENT_EXPORT PaymentAppContextImpl
+ : NON_EXPORTED_BASE(public PaymentAppContext),
+ public base::RefCountedThreadSafe<PaymentAppContextImpl> {
public:
- explicit PaymentAppContext(
- scoped_refptr<ServiceWorkerContextWrapper> service_worker_context);
+ PaymentAppContextImpl();
+
+ // Init and Shutdown are for use on the UI thread when the
+ // StoragePartition is being setup and torn down.
+ void Init(scoped_refptr<ServiceWorkerContextWrapper> service_worker_context);
// Shutdown must be called before deleting this. Call on the UI thread.
void Shutdown();
@@ -36,29 +41,35 @@ class CONTENT_EXPORT PaymentAppContext
// be deleted. Call on the IO thread.
void ServiceHadConnectionError(PaymentAppManager* service);
- ServiceWorkerContextWrapper* service_worker_context() const;
+ PaymentAppDatabase* payment_app_database() const;
+
+ void GetAllManifests(const GetAllManifestsCallback& callback) override;
protected:
- friend class base::RefCountedThreadSafe<PaymentAppContext>;
+ friend class base::RefCountedThreadSafe<PaymentAppContextImpl>;
friend class PaymentAppManagerTest;
- virtual ~PaymentAppContext();
+ virtual ~PaymentAppContextImpl();
private:
+ void CreatePaymentAppDatabaseOnIO(
+ scoped_refptr<ServiceWorkerContextWrapper> service_worker_context);
+
void CreateServiceOnIOThread(
mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request);
void ShutdownOnIO();
- scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
+ // Only accessed on the IO thread.
+ std::unique_ptr<PaymentAppDatabase> payment_app_database_;
// The services are owned by this. They're either deleted
// during ShutdownOnIO or when the channel is closed via
// ServiceHadConnectionError. Only accessed on the IO thread.
std::map<PaymentAppManager*, std::unique_ptr<PaymentAppManager>> services_;
- DISALLOW_COPY_AND_ASSIGN(PaymentAppContext);
+ DISALLOW_COPY_AND_ASSIGN(PaymentAppContextImpl);
};
} // namespace content
-#endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_H_
+#endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_CONTEXT_IMPL_H_
« 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