Chromium Code Reviews| 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; |
| } |