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

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: 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 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..1d9aa7c4efec24924d258887adbdaae7b38bb101 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"
#include "components/variations/pref_names.h"
#include "components/variations/proto/variations_seed.pb.h"
#include "crypto/signature_verifier.h"
@@ -143,7 +144,6 @@ VariationsSeedDateChangeState GetSeedDateChangeState(
#if defined(OS_ANDROID)
enum FirstRunResult {
FIRST_RUN_SEED_IMPORT_SUCCESS,
- FIRST_RUN_SEED_IMPORT_FAIL_NO_CALLBACK,
Alexei Svitkine (slow) 2015/11/12 16:26:55 Keep this entry.
Alexander Agulenko 2015/11/12 20:06:42 Done.
FIRST_RUN_SEED_IMPORT_FAIL_NO_FIRST_RUN_SEED,
FIRST_RUN_SEED_IMPORT_FAIL_STORE_FAILED,
FIRST_RUN_RESULT_ENUM_SIZE,
@@ -359,27 +359,22 @@ 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);
+ base::Time current_time;
+ bool is_gzip_compressed;
+
+ android::GetVariationsFirstRunSeed(&seed_data, &seed_signature, &seed_country,
+ &current_time, &is_gzip_compressed);
if (seed_data.empty()) {
RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_FAIL_NO_FIRST_RUN_SEED);
return;
}
- // 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