OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/variations/android/variations_seed_bridge.h" | 5 #include "components/variations/android/variations_seed_bridge.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 namespace variations { | 33 namespace variations { |
34 namespace android { | 34 namespace android { |
35 | 35 |
36 bool RegisterVariationsSeedBridge(JNIEnv* env) { | 36 bool RegisterVariationsSeedBridge(JNIEnv* env) { |
37 return RegisterNativesImpl(env); | 37 return RegisterNativesImpl(env); |
38 } | 38 } |
39 | 39 |
40 void GetVariationsFirstRunSeed(std::string* seed_data, | 40 void GetVariationsFirstRunSeed(std::string* seed_data, |
41 std::string* seed_signature, | 41 std::string* seed_signature, |
42 std::string* seed_country) { | 42 std::string* seed_country, |
| 43 std::string* response_date, |
| 44 bool* is_gzip_compressed) { |
43 JNIEnv* env = AttachCurrentThread(); | 45 JNIEnv* env = AttachCurrentThread(); |
44 ScopedJavaLocalRef<jbyteArray> j_seed_data = | 46 ScopedJavaLocalRef<jbyteArray> j_seed_data = |
45 Java_VariationsSeedBridge_getVariationsFirstRunSeedData( | 47 Java_VariationsSeedBridge_getVariationsFirstRunSeedData( |
46 env, GetApplicationContext()); | 48 env, GetApplicationContext()); |
47 ScopedJavaLocalRef<jstring> j_seed_signature = | 49 ScopedJavaLocalRef<jstring> j_seed_signature = |
48 Java_VariationsSeedBridge_getVariationsFirstRunSeedSignature( | 50 Java_VariationsSeedBridge_getVariationsFirstRunSeedSignature( |
49 env, GetApplicationContext()); | 51 env, GetApplicationContext()); |
50 ScopedJavaLocalRef<jstring> j_seed_country = | 52 ScopedJavaLocalRef<jstring> j_seed_country = |
51 Java_VariationsSeedBridge_getVariationsFirstRunSeedCountry( | 53 Java_VariationsSeedBridge_getVariationsFirstRunSeedCountry( |
52 env, GetApplicationContext()); | 54 env, GetApplicationContext()); |
| 55 ScopedJavaLocalRef<jstring> j_response_date = |
| 56 Java_VariationsSeedBridge_getVariationsFirstRunSeedDate( |
| 57 env, GetApplicationContext()); |
| 58 jboolean j_is_gzip_compressed = |
| 59 Java_VariationsSeedBridge_getVariationsFirstRunSeedIsGzipCompressed( |
| 60 env, GetApplicationContext()); |
53 *seed_data = JavaByteArrayToString(env, j_seed_data.obj()); | 61 *seed_data = JavaByteArrayToString(env, j_seed_data.obj()); |
54 *seed_signature = ConvertJavaStringToUTF8(j_seed_signature); | 62 *seed_signature = ConvertJavaStringToUTF8(j_seed_signature); |
55 *seed_country = ConvertJavaStringToUTF8(j_seed_country); | 63 *seed_country = ConvertJavaStringToUTF8(j_seed_country); |
| 64 *response_date = ConvertJavaStringToUTF8(j_response_date); |
| 65 *is_gzip_compressed = static_cast<bool>(j_is_gzip_compressed); |
56 } | 66 } |
57 | 67 |
58 void ClearJavaFirstRunPrefs() { | 68 void ClearJavaFirstRunPrefs() { |
59 JNIEnv* env = AttachCurrentThread(); | 69 JNIEnv* env = AttachCurrentThread(); |
60 Java_VariationsSeedBridge_clearFirstRunPrefs(env, GetApplicationContext()); | 70 Java_VariationsSeedBridge_clearFirstRunPrefs(env, GetApplicationContext()); |
61 } | 71 } |
62 | 72 |
63 void MarkVariationsSeedAsStored() { | 73 void MarkVariationsSeedAsStored() { |
64 JNIEnv* env = AttachCurrentThread(); | 74 JNIEnv* env = AttachCurrentThread(); |
65 Java_VariationsSeedBridge_markVariationsSeedAsStored(env, | 75 Java_VariationsSeedBridge_markVariationsSeedAsStored(env, |
66 GetApplicationContext()); | 76 GetApplicationContext()); |
67 } | 77 } |
68 | 78 |
69 } // namespace android | 79 } // namespace android |
70 } // namespace variations | 80 } // namespace variations |
OLD | NEW |