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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_
6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "components/payments/payment_app.mojom.h"
14 #include "content/browser/service_worker/service_worker_context_wrapper.h"
15 #include "content/browser/service_worker/service_worker_registration.h"
16 #include "content/common/content_export.h"
17 #include "content/common/service_worker/service_worker_status_code.h"
18 #include "mojo/public/cpp/bindings/binding.h"
19
20 namespace content {
21
22 class ServiceWorkerRegistration;
23
24 class CONTENT_EXPORT PaymentAppDatabase {
25 public:
26 using WriteManifestCallback =
27 base::Callback<void(payments::mojom::PaymentAppManifestError)>;
28 using ReadManifestCallback =
29 base::Callback<void(payments::mojom::PaymentAppManifestPtr,
30 payments::mojom::PaymentAppManifestError)>;
31
32 explicit PaymentAppDatabase(
33 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context);
34 ~PaymentAppDatabase();
35
36 void WriteManifest(const GURL& scope,
37 payments::mojom::PaymentAppManifestPtr manifest,
38 const WriteManifestCallback& callback);
39 void ReadManifest(const GURL& scope, const ReadManifestCallback& callback);
40
41 private:
42 // WriteManifest callbacks
43 void DidFindRegistrationToWriteManifest(
44 payments::mojom::PaymentAppManifestPtr manifest,
45 const WriteManifestCallback& callback,
46 ServiceWorkerStatusCode status,
47 scoped_refptr<ServiceWorkerRegistration> registration);
48 void DidWriteManifest(const WriteManifestCallback& callback,
49 ServiceWorkerStatusCode status);
50
51 // ReadManifest callbacks
52 void DidFindRegistrationToReadManifest(
53 const ReadManifestCallback& callback,
54 ServiceWorkerStatusCode status,
55 scoped_refptr<ServiceWorkerRegistration> registration);
56 void DidReadManifest(const ReadManifestCallback& callback,
57 const std::vector<std::string>& data,
58 ServiceWorkerStatusCode status);
59
60 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
61 base::WeakPtrFactory<PaymentAppDatabase> weak_ptr_factory_;
62
63 DISALLOW_COPY_AND_ASSIGN(PaymentAppDatabase);
64 };
65
66 } // namespace content
67
68 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_
OLDNEW
« 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