Chromium Code Reviews| 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..d03e6e3b7a550511b9fb0f2e77faf19b9e4c8922 |
| --- /dev/null |
| +++ b/content/browser/payments/payment_app_database.h |
| @@ -0,0 +1,69 @@ |
| +// 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 std::string& scope, |
|
please use gerrit instead
2016/12/09 21:58:47
Can we use GURL for scope?
zino
2016/12/09 22:30:16
Done.
|
| + payments::mojom::PaymentAppManifestPtr manifest, |
| + const WriteManifestCallback& callback); |
| + void ReadManifest(const std::string& 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_ |