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