Index: chrome/browser/android/preferences/pref_service_bridge.cc |
diff --git a/chrome/browser/android/preferences/pref_service_bridge.cc b/chrome/browser/android/preferences/pref_service_bridge.cc |
index 5b5f4b54ac3b2e812c18acfc28a2a45e8f9c3d3a..50fccb97c213251c32eb4bc0ee319e70c33740f0 100644 |
--- a/chrome/browser/android/preferences/pref_service_bridge.cc |
+++ b/chrome/browser/android/preferences/pref_service_bridge.cc |
@@ -5,13 +5,17 @@ |
#include "chrome/browser/android/preferences/pref_service_bridge.h" |
#include <jni.h> |
+#include <vector> |
Alexei Svitkine (slow)
2015/11/04 16:47:23
Is this needed anymore?
|
#include "base/android/build_info.h" |
#include "base/android/jni_android.h" |
+#include "base/android/jni_array.h" |
Alexei Svitkine (slow)
2015/11/04 16:47:23
Is this needed anymore?
|
#include "base/android/jni_string.h" |
#include "base/android/jni_weak_ref.h" |
+#include "base/base64.h" |
#include "base/files/file_path.h" |
#include "base/files/file_util.h" |
+#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/prefs/pref_service.h" |
#include "base/strings/string_util.h" |
@@ -36,6 +40,7 @@ |
#include "components/signin/core/common/signin_pref_names.h" |
#include "components/translate/core/browser/translate_prefs.h" |
#include "components/translate/core/common/translate_pref_names.h" |
+#include "components/variations/pref_names.h" |
#include "components/version_info/version_info.h" |
#include "components/web_resource/web_resource_pref_names.h" |
#include "content/public/browser/browser_thread.h" |
@@ -47,6 +52,7 @@ using base::android::AttachCurrentThread; |
using base::android::CheckException; |
using base::android::ConvertJavaStringToUTF8; |
using base::android::ConvertUTF8ToJavaString; |
+using base::android::GetApplicationContext; |
using base::android::ScopedJavaLocalRef; |
using base::android::ScopedJavaGlobalRef; |
using content::BrowserThread; |
@@ -948,3 +954,23 @@ std::string PrefServiceBridge::GetAndroidPermissionForContentSetting( |
return ConvertJavaStringToUTF8(android_permission); |
} |
+ |
+// static |
+void PrefServiceBridge::GetVariationsFirstRunSeed(std::string* seed_data, |
+ std::string* seed_signature, |
+ std::string* seed_country) { |
+ JNIEnv* env = AttachCurrentThread(); |
+ ScopedJavaLocalRef<jstring> j_seed_data = |
+ Java_PrefServiceBridge_getVariationsFirstRunSeedData( |
Alexei Svitkine (slow)
2015/11/04 16:47:23
Nit: Now that you're returning base64, please name
|
+ env, GetApplicationContext()); |
+ ScopedJavaLocalRef<jstring> j_seed_signature = |
+ Java_PrefServiceBridge_getVariationsFirstRunSeedSignature( |
+ env, GetApplicationContext()); |
+ ScopedJavaLocalRef<jstring> j_seed_country = |
+ Java_PrefServiceBridge_getVariationsFirstRunSeedCountry( |
+ env, GetApplicationContext()); |
+ // deserialize raw seed data. |
Alexei Svitkine (slow)
2015/11/04 16:47:23
Nit: Capitalize
|
+ base::Base64Decode(ConvertJavaStringToUTF8(j_seed_data), seed_data); |
Alexei Svitkine (slow)
2015/11/04 16:47:23
Nit: This API could potentially fail. I think it s
|
+ *seed_signature = ConvertJavaStringToUTF8(j_seed_signature); |
+ *seed_country = ConvertJavaStringToUTF8(j_seed_country); |
+} |