| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/prefs/tracked/tracked_atomic_preference.h" | 5 #include "chrome/browser/prefs/tracked/tracked_atomic_preference.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/prefs/pref_hash_store.h" | 8 #include "chrome/browser/prefs/pref_hash_store.h" |
| 9 | 9 |
| 10 TrackedAtomicPreference::TrackedAtomicPreference( | 10 TrackedAtomicPreference::TrackedAtomicPreference( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 pref_store_contents->Get(pref_path_, &value); | 29 pref_store_contents->Get(pref_path_, &value); |
| 30 PrefHashStore::ValueState value_state = | 30 PrefHashStore::ValueState value_state = |
| 31 pref_hash_store_->CheckValue(pref_path_, value); | 31 pref_hash_store_->CheckValue(pref_path_, value); |
| 32 | 32 |
| 33 helper_.ReportValidationResult(value_state); | 33 helper_.ReportValidationResult(value_state); |
| 34 | 34 |
| 35 TrackedPreferenceHelper::ResetAction reset_action = | 35 TrackedPreferenceHelper::ResetAction reset_action = |
| 36 helper_.GetAction(value_state); | 36 helper_.GetAction(value_state); |
| 37 helper_.ReportAction(reset_action); | 37 helper_.ReportAction(reset_action); |
| 38 | 38 |
| 39 if (reset_action == TrackedPreferenceHelper::DO_RESET) | 39 if (reset_action == TrackedPreferenceHelper::DO_RESET) { |
| 40 pref_store_contents->RemovePath(pref_path_, NULL); | 40 pref_store_contents->RemovePath(pref_path_, NULL); |
| 41 pref_hash_store_->RecordResetEvent(); |
| 42 } |
| 41 | 43 |
| 42 if (value_state != PrefHashStore::UNCHANGED) { | 44 if (value_state != PrefHashStore::UNCHANGED) { |
| 43 // Store the hash for the new value (whether it was reset or not). | 45 // Store the hash for the new value (whether it was reset or not). |
| 44 const base::Value* new_value = NULL; | 46 const base::Value* new_value = NULL; |
| 45 pref_store_contents->Get(pref_path_, &new_value); | 47 pref_store_contents->Get(pref_path_, &new_value); |
| 46 pref_hash_store_->StoreHash(pref_path_, new_value); | 48 pref_hash_store_->StoreHash(pref_path_, new_value); |
| 47 } | 49 } |
| 48 } | 50 } |
| OLD | NEW |