OLD | NEW |
---|---|
(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 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.
| |
37 payments::mojom::PaymentAppManifestPtr manifest, | |
38 const WriteManifestCallback& callback); | |
39 void ReadManifest(const std::string& scope, | |
40 const ReadManifestCallback& callback); | |
41 | |
42 private: | |
43 // WriteManifest callbacks | |
44 void DidFindRegistrationToWriteManifest( | |
45 payments::mojom::PaymentAppManifestPtr manifest, | |
46 const WriteManifestCallback& callback, | |
47 ServiceWorkerStatusCode status, | |
48 scoped_refptr<ServiceWorkerRegistration> registration); | |
49 void DidWriteManifest(const WriteManifestCallback& callback, | |
50 ServiceWorkerStatusCode status); | |
51 | |
52 // ReadManifest callbacks | |
53 void DidFindRegistrationToReadManifest( | |
54 const ReadManifestCallback& callback, | |
55 ServiceWorkerStatusCode status, | |
56 scoped_refptr<ServiceWorkerRegistration> registration); | |
57 void DidReadManifest(const ReadManifestCallback& callback, | |
58 const std::vector<std::string>& data, | |
59 ServiceWorkerStatusCode status); | |
60 | |
61 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | |
62 base::WeakPtrFactory<PaymentAppDatabase> weak_ptr_factory_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(PaymentAppDatabase); | |
65 }; | |
66 | |
67 } // namespace content | |
68 | |
69 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_DATABASE_H_ | |
OLD | NEW |