Fix emulator build error
[platform/framework/web/chromium-efl.git] / base / android / unguessable_token_android.h
1 // Copyright 2016 The Chromium Authors
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 absl::optional<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   UnguessableTokenAndroid() = delete;
37   UnguessableTokenAndroid(const UnguessableTokenAndroid&) = delete;
38   UnguessableTokenAndroid& operator=(const UnguessableTokenAndroid&) = delete;
39 };
40
41 }  // namespace android
42 }  // namespace base
43
44 #endif  // BASE_ANDROID_UNGUESSABLE_TOKEN_ANDROID_H_