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

Unified Diff: components/variations/variations_seed_store.cc

Issue 1437833004: Implemented clearing Java prefs after pulling variations first run seed from Java to C++ side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit tests failure 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
« no previous file with comments | « components/variations/android/variations_seed_bridge.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..91fc4e65f2997a553844e21fba5f83c6e9eb094e 100644
--- a/components/variations/variations_seed_store.cc
+++ b/components/variations/variations_seed_store.cc
@@ -17,6 +17,10 @@
#include "crypto/signature_verifier.h"
#include "third_party/protobuf/src/google/protobuf/io/coded_stream.h"
+#if defined(OS_ANDROID)
+#include "components/variations/android/variations_seed_bridge.h"
+#endif // OS_ANDROID
+
namespace variations {
namespace {
@@ -384,7 +388,6 @@ void VariationsSeedStore::ImportFirstRunJavaSeed() {
LOG(WARNING) << "First run variations seed is invalid.";
return;
}
- // TODO(agulenko): Clear Java prefs.
RecordFirstRunResult(FIRST_RUN_SEED_IMPORT_SUCCESS);
}
#endif // OS_ANDROID
@@ -464,6 +467,16 @@ bool VariationsSeedStore::StoreSeedDataNoDelta(
// in M45+.
local_state_->ClearPref(prefs::kVariationsSeed);
+#if defined(OS_ANDROID)
+ // If currently we do not have any stored pref then we mark seed storing as
+ // successful on the Java side of Chrome for Android to avoid repeated seed
+ // fetches and clear preferences on the Java side.
+ if (local_state_->GetString(prefs::kVariationsCompressedSeed).empty()) {
+ android::MarkVariationsSeedAsStored();
+ android::ClearJavaFirstRunPrefs();
+ }
+#endif
+
// Update the saved country code only if one was returned from the server.
// Prefer the country code that was transmitted in the header over the one in
// the seed (which is deprecated).
« no previous file with comments | « components/variations/android/variations_seed_bridge.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698