| 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_
|
|
|