OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 COMPONENTS_PAYMENTS_CONTENT_ANDROID_PAYMENT_MANIFEST_PARSER_ANDROID_H_ |
| 6 #define COMPONENTS_PAYMENTS_CONTENT_ANDROID_PAYMENT_MANIFEST_PARSER_ANDROID_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 #include <memory> |
| 10 #include <vector> |
| 11 |
| 12 #include "base/android/jni_android.h" |
| 13 #include "base/android/scoped_java_ref.h" |
| 14 #include "base/macros.h" |
| 15 #include "components/payments/content/android/payment_manifest_parser.mojom.h" |
| 16 |
| 17 namespace content { |
| 18 template <class MojoInterface> |
| 19 class UtilityProcessMojoClient; |
| 20 } |
| 21 |
| 22 namespace payments { |
| 23 |
| 24 // Host of the utility process that parses manifest contents. |
| 25 class PaymentManifestParserAndroid { |
| 26 public: |
| 27 PaymentManifestParserAndroid(); |
| 28 ~PaymentManifestParserAndroid(); |
| 29 |
| 30 void StartUtilityProcess(JNIEnv* env, |
| 31 const base::android::JavaParamRef<jobject>& jcaller); |
| 32 |
| 33 void ParsePaymentManifest( |
| 34 JNIEnv* env, |
| 35 const base::android::JavaParamRef<jobject>& jcaller, |
| 36 const base::android::JavaParamRef<jstring>& jcontent, |
| 37 const base::android::JavaParamRef<jobject>& jcallback); |
| 38 |
| 39 // Deletes this object. |
| 40 void StopUtilityProcess(JNIEnv* env, |
| 41 const base::android::JavaParamRef<jobject>& jcaller); |
| 42 |
| 43 private: |
| 44 class ParseCallback; |
| 45 |
| 46 // The |callback_identifier| parameter is a pointer to one of the owned |
| 47 // elements in the |pending_callbacks_| list. |
| 48 void OnParse(ParseCallback* callback_identifier, |
| 49 std::vector<mojom::PaymentManifestSectionPtr> manifest); |
| 50 |
| 51 void OnUtilityProcessStopped(); |
| 52 |
| 53 std::unique_ptr< |
| 54 content::UtilityProcessMojoClient<mojom::PaymentManifestParser>> |
| 55 mojo_client_; |
| 56 std::vector<std::unique_ptr<ParseCallback>> pending_callbacks_; |
| 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(PaymentManifestParserAndroid); |
| 59 }; |
| 60 |
| 61 bool RegisterPaymentManifestParser(JNIEnv* env); |
| 62 |
| 63 } // namespace payments |
| 64 |
| 65 #endif // COMPONENTS_PAYMENTS_CONTENT_ANDROID_PAYMENT_MANIFEST_PARSER_ANDROID_H
_ |
OLD | NEW |