Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: components/variations/android/variations_seed_bridge.cc

Issue 1438123002: Removed callbacks to JNI functions + added gzip compressed seed support & pulling response time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implemented the rest TODOs: pulling time from response and GZIP compressed seed support Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698