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 <stdint.h> | 8 #include <stdint.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 const std::string& str_data) { | 36 const std::string& str_data) { |
37 std::vector<uint8_t> array_data(str_data.begin(), str_data.end()); | 37 std::vector<uint8_t> array_data(str_data.begin(), str_data.end()); |
38 return base::android::ToJavaByteArray(env, array_data); | 38 return base::android::ToJavaByteArray(env, array_data); |
39 } | 39 } |
40 | 40 |
41 } // namespace | 41 } // namespace |
42 | 42 |
43 namespace variations { | 43 namespace variations { |
44 namespace android { | 44 namespace android { |
45 | 45 |
46 bool RegisterVariationsSeedBridge(JNIEnv* env) { | |
47 return RegisterNativesImpl(env); | |
48 } | |
49 | |
50 void GetVariationsFirstRunSeed(std::string* seed_data, | 46 void GetVariationsFirstRunSeed(std::string* seed_data, |
51 std::string* seed_signature, | 47 std::string* seed_signature, |
52 std::string* seed_country, | 48 std::string* seed_country, |
53 std::string* response_date, | 49 std::string* response_date, |
54 bool* is_gzip_compressed) { | 50 bool* is_gzip_compressed) { |
55 JNIEnv* env = AttachCurrentThread(); | 51 JNIEnv* env = AttachCurrentThread(); |
56 ScopedJavaLocalRef<jbyteArray> j_seed_data = | 52 ScopedJavaLocalRef<jbyteArray> j_seed_data = |
57 Java_VariationsSeedBridge_getVariationsFirstRunSeedData( | 53 Java_VariationsSeedBridge_getVariationsFirstRunSeedData( |
58 env, GetApplicationContext()); | 54 env, GetApplicationContext()); |
59 ScopedJavaLocalRef<jstring> j_seed_signature = | 55 ScopedJavaLocalRef<jstring> j_seed_signature = |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 Java_VariationsSeedBridge_setVariationsFirstRunSeed( | 91 Java_VariationsSeedBridge_setVariationsFirstRunSeed( |
96 env, GetApplicationContext(), StringToJavaByteArray(env, seed_data).obj(), | 92 env, GetApplicationContext(), StringToJavaByteArray(env, seed_data).obj(), |
97 ConvertUTF8ToJavaString(env, seed_signature).obj(), | 93 ConvertUTF8ToJavaString(env, seed_signature).obj(), |
98 ConvertUTF8ToJavaString(env, seed_country).obj(), | 94 ConvertUTF8ToJavaString(env, seed_country).obj(), |
99 ConvertUTF8ToJavaString(env, response_date).obj(), | 95 ConvertUTF8ToJavaString(env, response_date).obj(), |
100 static_cast<jboolean>(is_gzip_compressed)); | 96 static_cast<jboolean>(is_gzip_compressed)); |
101 } | 97 } |
102 | 98 |
103 } // namespace android | 99 } // namespace android |
104 } // namespace variations | 100 } // namespace variations |
OLD | NEW |