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

Unified Diff: components/variations/variations_seed_store.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: Added header values trimming. 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: components/variations/variations_seed_store.cc
diff --git a/components/variations/variations_seed_store.cc b/components/variations/variations_seed_store.cc
index 84dca7e3ce91341fab819cdd6a711b0d122de543..33bd6007da3cb58162a27c8a22919ee6f3c0e29e 100644
--- a/components/variations/variations_seed_store.cc
+++ b/components/variations/variations_seed_store.cc
@@ -12,6 +12,7 @@
#include "base/sha1.h"
#include "base/strings/string_number_conversions.h"
#include "components/compression/compression_utils.h"
+#include "components/variations/android/variations_seed_bridge.h"
Alexei Svitkine (slow) 2015/11/12 22:25:29 Put this include in ifdef and put it below the oth
Alexander Agulenko 2015/11/12 22:37:55 Done.
#include "components/variations/pref_names.h"
#include "components/variations/proto/variations_seed.pb.h"
#include "crypto/signature_verifier.h"
@@ -359,27 +360,24 @@ void VariationsSeedStore::ClearPrefs() {
#if defined(OS_ANDROID)
void VariationsSeedStore::ImportFirstRunJavaSeed() {
DVLOG(1) << "Importing first run seed from Java preferences.";
- if (get_variations_first_run_seed_.is_null()) {
- RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_FAIL_NO_CALLBACK);
- return;
- }
std::string seed_data;
std::string seed_signature;
std::string seed_country;
- get_variations_first_run_seed_.Run(&seed_data, &seed_signature,
- &seed_country);
+ std::string response_time;
+ base::Time current_time;
+ bool is_gzip_compressed;
Alexei Svitkine (slow) 2015/11/12 22:25:29 Move this right above the time parsing code.
Alexander Agulenko 2015/11/12 22:37:55 Done.
+
+ android::GetVariationsFirstRunSeed(&seed_data, &seed_signature, &seed_country,
+ &response_time, &is_gzip_compressed);
if (seed_data.empty()) {
RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_FAIL_NO_FIRST_RUN_SEED);
return;
}
+ base::Time::FromString(response_time.c_str(), &current_time);
Alexei Svitkine (slow) 2015/11/12 22:25:29 To match how we do it on the C++ side, this should
Alexander Agulenko 2015/11/12 22:37:55 Done.
- // TODO(agulenko): Pull actual time from the response.
- base::Time current_time = base::Time::Now();
-
- // TODO(agulenko): Support gzip compressed seed.
if (!StoreSeedData(seed_data, seed_signature, seed_country, current_time,
- false, false, nullptr)) {
+ false, is_gzip_compressed, nullptr)) {
RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_FAIL_STORE_FAILED);
LOG(WARNING) << "First run variations seed is invalid.";
return;

Powered by Google App Engine
This is Rietveld 408576698