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

Unified Diff: content/browser/payments/payment_app_database.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_database.h
diff --git a/content/browser/payments/payment_app_database.h b/content/browser/payments/payment_app_database.h
new file mode 100644
index 0000000000000000000000000000000000000000..d27b7d838914bcd1999c0e681d38986f6ed810fe
--- /dev/null
+++ b/content/browser/payments/payment_app_database.h
@@ -0,0 +1,68 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// 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_DATABASE_H_
+#define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_
+
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "components/payments/payment_app.mojom.h"
+#include "content/browser/service_worker/service_worker_context_wrapper.h"
+#include "content/browser/service_worker/service_worker_registration.h"
+#include "content/common/content_export.h"
+#include "content/common/service_worker/service_worker_status_code.h"
+#include "mojo/public/cpp/bindings/binding.h"
+
+namespace content {
+
+class ServiceWorkerRegistration;
+
+class CONTENT_EXPORT PaymentAppDatabase {
+ public:
+ using WriteManifestCallback =
+ base::Callback<void(payments::mojom::PaymentAppManifestError)>;
+ using ReadManifestCallback =
+ base::Callback<void(payments::mojom::PaymentAppManifestPtr,
+ payments::mojom::PaymentAppManifestError)>;
+
+ explicit PaymentAppDatabase(
+ scoped_refptr<ServiceWorkerContextWrapper> service_worker_context);
+ ~PaymentAppDatabase();
+
+ void WriteManifest(const GURL& scope,
+ payments::mojom::PaymentAppManifestPtr manifest,
+ const WriteManifestCallback& callback);
+ void ReadManifest(const GURL& scope, const ReadManifestCallback& callback);
+
+ private:
+ // WriteManifest callbacks
+ void DidFindRegistrationToWriteManifest(
+ payments::mojom::PaymentAppManifestPtr manifest,
+ const WriteManifestCallback& callback,
+ ServiceWorkerStatusCode status,
+ scoped_refptr<ServiceWorkerRegistration> registration);
+ void DidWriteManifest(const WriteManifestCallback& callback,
+ ServiceWorkerStatusCode status);
+
+ // ReadManifest callbacks
+ void DidFindRegistrationToReadManifest(
+ const ReadManifestCallback& callback,
+ ServiceWorkerStatusCode status,
+ scoped_refptr<ServiceWorkerRegistration> registration);
+ void DidReadManifest(const ReadManifestCallback& callback,
+ const std::vector<std::string>& data,
+ ServiceWorkerStatusCode status);
+
+ scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
+ base::WeakPtrFactory<PaymentAppDatabase> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(PaymentAppDatabase);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_
« no previous file with comments | « content/browser/payments/payment_app_context_impl.cc ('k') | content/browser/payments/payment_app_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698