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

Unified Diff: components/user_prefs/tracked/tracked_split_preference.cc

Issue 2204943002: Integrate registry_hash_store_contents with the rest of tracked prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Experiment with giving two transactions to EnforceAndReport Created 4 years, 4 months 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/user_prefs/tracked/tracked_split_preference.cc
diff --git a/components/user_prefs/tracked/tracked_split_preference.cc b/components/user_prefs/tracked/tracked_split_preference.cc
index 37bac10b760a01ebd011bb1283d813a7f8718eb5..55ccf3ee2e8b2b038ce5e3fdf44a0b9e26d249d8 100644
--- a/components/user_prefs/tracked/tracked_split_preference.cc
+++ b/components/user_prefs/tracked/tracked_split_preference.cc
@@ -40,7 +40,8 @@ void TrackedSplitPreference::OnNewValue(
bool TrackedSplitPreference::EnforceAndReport(
base::DictionaryValue* pref_store_contents,
- PrefHashStoreTransaction* transaction) const {
+ PrefHashStoreTransaction* transaction,
+ PrefHashStoreTransaction* registry_transaction) const {
base::DictionaryValue* dict_value = NULL;
if (!pref_store_contents->GetDictionary(pref_path_, &dict_value) &&
pref_store_contents->Get(pref_path_, NULL)) {
@@ -56,14 +57,26 @@ bool TrackedSplitPreference::EnforceAndReport(
if (value_state == PrefHashStoreTransaction::CHANGED)
helper_.ReportSplitPreferenceChangedCount(invalid_keys.size());
- helper_.ReportValidationResult(value_state);
+ helper_.ReportValidationResult(value_state, transaction->GetStoreType());
+
+ PrefHashStoreTransaction::ValueState registry_value_state =
+ PrefHashStoreTransaction::UNCHANGED;
+ if (registry_transaction) {
+ std::vector<std::string> invalid_registry_keys;
+ registry_value_state = registry_transaction->CheckSplitValue(
+ pref_path_, dict_value, &invalid_registry_keys);
+ helper_.ReportValidationResult(registry_value_state,
+ registry_transaction->GetStoreType());
+
+ // TODO(proberge): Call delegate_->OnSplitPreferenceValidation.
+ }
- TrackedPreferenceHelper::ResetAction reset_action =
- helper_.GetAction(value_state);
if (delegate_) {
delegate_->OnSplitPreferenceValidation(pref_path_, dict_value, invalid_keys,
value_state, helper_.IsPersonal());
}
+ TrackedPreferenceHelper::ResetAction reset_action =
+ helper_.GetAction(value_state);
helper_.ReportAction(reset_action);
bool was_reset = false;
@@ -88,5 +101,13 @@ bool TrackedSplitPreference::EnforceAndReport(
transaction->StoreSplitHash(pref_path_, new_dict_value);
}
+ if (registry_transaction &&
+ (value_state != PrefHashStoreTransaction::UNCHANGED ||
gab 2016/08/03 18:19:36 ditto: |was_reset|
proberge 2016/08/04 00:13:47 Done.
+ registry_value_state != PrefHashStoreTransaction::UNCHANGED)) {
+ const base::DictionaryValue* new_dict_value = NULL;
+ pref_store_contents->GetDictionary(pref_path_, &new_dict_value);
+ transaction->StoreSplitHash(pref_path_, new_dict_value);
+ }
+
return was_reset;
}

Powered by Google App Engine
This is Rietveld 408576698