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 BASE_ANDROID_UNGUESSABLE_TOKEN_ANDROID_H_ |
| 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_ |
OLD | NEW |