Chromium Code Reviews| 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 base::Time* response_time, | |
| 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_time = | |
| 56 Java_VariationsSeedBridge_getVariationsFirstRunSeedDate( | |
| 57 env, GetApplicationContext()); | |
| 58 jboolean j_is_gzip_compressed = | |
| 59 Java_VariationsSeedBridge_getVariationsFirstRunSeedIsGzipCompressed( | |
| 60 env, GetApplicationContext()); | |
| 61 base::Time::FromString(ConvertJavaStringToUTF8(env, j_response_time).c_str(), | |
|
Alexei Svitkine (slow)
2015/11/12 16:26:55
I think this logic should be in the variations cod
Alexander Agulenko
2015/11/12 20:07:42
Acknowledged (still working on it).
Alexander Agulenko
2015/11/12 20:15:40
Done.
| |
| 62 response_time); | |
| 53 *seed_data = JavaByteArrayToString(env, j_seed_data.obj()); | 63 *seed_data = JavaByteArrayToString(env, j_seed_data.obj()); |
| 54 *seed_signature = ConvertJavaStringToUTF8(j_seed_signature); | 64 *seed_signature = ConvertJavaStringToUTF8(j_seed_signature); |
| 55 *seed_country = ConvertJavaStringToUTF8(j_seed_country); | 65 *seed_country = ConvertJavaStringToUTF8(j_seed_country); |
| 66 *is_gzip_compressed = static_cast<bool>(j_is_gzip_compressed); | |
| 56 } | 67 } |
| 57 | 68 |
| 58 } // namespace android | 69 } // namespace android |
| 59 } // namespace variations | 70 } // namespace variations |
| OLD | NEW |