summaryrefslogtreecommitdiffstats
path: root/components/variations/variations_seed_store.cc
diff options
context:
space:
mode:
authoragulenko <agulenko@google.com>2015-11-17 20:52:49 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-18 04:53:39 +0000
commitff14aff0758577956d4704050ef3d546a9bac624 (patch)
tree692f53b263b0347a1feffd16dd961caa0148137c /components/variations/variations_seed_store.cc
parent71f108c5f16cf6802a91dc7a3fed0a9dcb8b8473 (diff)
downloadchromium_src-ff14aff0758577956d4704050ef3d546a9bac624.zip
chromium_src-ff14aff0758577956d4704050ef3d546a9bac624.tar.gz
chromium_src-ff14aff0758577956d4704050ef3d546a9bac624.tar.bz2
Removed callbacks to JNI functions to simplify code structure since they are no longer needed.
Also added gzip compressed seed support and pulling the actual time of HTTP response. BUG=551029 Review URL: https://codereview.chromium.org/1438123002 Cr-Commit-Position: refs/heads/master@{#360292}
Diffstat (limited to 'components/variations/variations_seed_store.cc')
-rw-r--r--components/variations/variations_seed_store.cc20
1 files changed, 9 insertions, 11 deletions
diff --git a/components/variations/variations_seed_store.cc b/components/variations/variations_seed_store.cc
index 91fc4e6..9054eae 100644
--- a/components/variations/variations_seed_store.cc
+++ b/components/variations/variations_seed_store.cc
@@ -363,27 +363,25 @@ 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_date;
+ bool is_gzip_compressed;
+
+ android::GetVariationsFirstRunSeed(&seed_data, &seed_signature, &seed_country,
+ &response_date, &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();
+ base::Time current_date;
+ base::Time::FromUTCString(response_date.c_str(), &current_date);
- // TODO(agulenko): Support gzip compressed seed.
- if (!StoreSeedData(seed_data, seed_signature, seed_country, current_time,
- false, false, nullptr)) {
+ if (!StoreSeedData(seed_data, seed_signature, seed_country, current_date,
+ false, is_gzip_compressed, nullptr)) {
RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_FAIL_STORE_FAILED);
LOG(WARNING) << "First run variations seed is invalid.";
return;