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

Unified Diff: chrome/browser/android/preferences/pref_service_bridge.cc

Issue 1417503010: Variations seed is pulled from the Java application on the first launch of Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes according to latest code review. 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 side-by-side diff with in-line comments
Download patch
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..85df582569539214e13403da3a16624340c04ad0 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>
#include "base/android/build_info.h"
#include "base/android/jni_android.h"
+#include "base/android/jni_array.h"
#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(
+ env, GetApplicationContext());
Bernhard Bauer 2015/11/04 09:08:57 Indent. Please just run `git cl format` over your
Alexander Agulenko 2015/11/04 09:42:29 I have already run this command but git ignored wh
Bernhard Bauer 2015/11/04 09:59:59 Ok, then you probably should configure Git not to
+ ScopedJavaLocalRef<jstring> j_seed_signature =
+ Java_PrefServiceBridge_getVariationsFirstRunSeedSignature(
+ env, GetApplicationContext());
+ ScopedJavaLocalRef<jstring> j_seed_country =
+ Java_PrefServiceBridge_getVariationsFirstRunSeedCountry(
+ env, GetApplicationContext());
+ base::Base64Decode(ConvertJavaStringToUTF8(j_seed_data), seed_data);
+ *seed_signature = ConvertJavaStringToUTF8(j_seed_signature);
+ *seed_country = ConvertJavaStringToUTF8(j_seed_country);
+}

Powered by Google App Engine
This is Rietveld 408576698