| 6 | #define BASE_ANDROID_UNGUESSABLE_TOKEN_ANDROID_H_ |
| 7 |
| 8 | #include <jni.h> |
| 9 |
| 10 | #include "base/android/scoped_java_ref.h" |
| 11 | #include "base/base_export.h" |
| 12 | #include "base/unguessable_token.h" |
| 13 |
| 14 | namespace base { |
| 15 | namespace android { |
| 16 |
| 17 | class BASE_EXPORT UnguessableTokenAndroid { |
| 18 | public: |
| 19 | // Create a Java UnguessableToken with the same value as |token|. |
| 20 | static ScopedJavaLocalRef<jobject> Create( |
| 21 | JNIEnv* env, |
| 22 | const base::UnguessableToken& token); |
| 23 |
| 24 | // Create a native UnguessableToken from Java UnguessableToken |token|. |
| 25 | static base::UnguessableToken FromJavaUnguessableToken( |
| 26 | JNIEnv* env, |
| 27 | const JavaRef<jobject>& token); |
| 28 |
| 29 | // Parcel UnguessableToken |token| and unparcel it, and return the result. |
| 30 | // While this method is intended for facilitating unit tests, it results only |
| 31 | // in a clone of |token|. |
| 32 | static ScopedJavaLocalRef<jobject> ParcelAndUnparcelForTesting( |
| 33 | JNIEnv* env, |
| 34 | const JavaRef<jobject>& token); |
| 35 |
| 36 | private: |
| 37 | DISALLOW_COPY_AND_ASSIGN(UnguessableTokenAndroid); |
| 38 | }; |
| 39 |
| 40 | } // namespace android |
| 41 | } // namespace base |
| 42 |
| 43 | #endif // BASE_ANDROID_UNGUESSABLE_TOKEN_ANDROID_H_ |
| 44 |