| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/user_prefs/tracked/pref_hash_filter.h" | 5 #include "components/user_prefs/tracked/pref_hash_filter.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 did_reset = true; | 242 did_reset = true; |
| 243 prefs_altered = true; | 243 prefs_altered = true; |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 if (hash_store_transaction->StampSuperMac()) | 246 if (hash_store_transaction->StampSuperMac()) |
| 247 prefs_altered = true; | 247 prefs_altered = true; |
| 248 } | 248 } |
| 249 | 249 |
| 250 if (did_reset) { | 250 if (did_reset) { |
| 251 pref_store_contents->Set(user_prefs::kPreferenceResetTime, | 251 pref_store_contents->Set(user_prefs::kPreferenceResetTime, |
| 252 new base::StringValue(base::Int64ToString( | 252 new base::Value(base::Int64ToString( |
| 253 base::Time::Now().ToInternalValue()))); | 253 base::Time::Now().ToInternalValue()))); |
| 254 FilterUpdate(user_prefs::kPreferenceResetTime); | 254 FilterUpdate(user_prefs::kPreferenceResetTime); |
| 255 | 255 |
| 256 if (!on_reset_on_load_.is_null()) | 256 if (!on_reset_on_load_.is_null()) |
| 257 on_reset_on_load_.Run(); | 257 on_reset_on_load_.Run(); |
| 258 } | 258 } |
| 259 | 259 |
| 260 UMA_HISTOGRAM_TIMES("Settings.FilterOnLoadTime", | 260 UMA_HISTOGRAM_TIMES("Settings.FilterOnLoadTime", |
| 261 base::TimeTicks::Now() - checkpoint); | 261 base::TimeTicks::Now() - checkpoint); |
| 262 | 262 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 for (base::DictionaryValue::Iterator inner_it(*split_values); | 295 for (base::DictionaryValue::Iterator inner_it(*split_values); |
| 296 !inner_it.IsAtEnd(); inner_it.Advance()) { | 296 !inner_it.IsAtEnd(); inner_it.Advance()) { |
| 297 std::string mac; | 297 std::string mac; |
| 298 bool is_string = inner_it.value().GetAsString(&mac); | 298 bool is_string = inner_it.value().GetAsString(&mac); |
| 299 DCHECK(is_string); | 299 DCHECK(is_string); |
| 300 | 300 |
| 301 external_validation_hash_store_contents->SetSplitMac( | 301 external_validation_hash_store_contents->SetSplitMac( |
| 302 changed_path, inner_it.key(), mac); | 302 changed_path, inner_it.key(), mac); |
| 303 } | 303 } |
| 304 } else { | 304 } else { |
| 305 const base::StringValue* value_as_string; | 305 const base::Value* value_as_string; |
| 306 bool is_string = it.value().GetAsString(&value_as_string); | 306 bool is_string = it.value().GetAsString(&value_as_string); |
| 307 DCHECK(is_string); | 307 DCHECK(is_string); |
| 308 | 308 |
| 309 external_validation_hash_store_contents->SetMac( | 309 external_validation_hash_store_contents->SetMac( |
| 310 changed_path, value_as_string->GetString()); | 310 changed_path, value_as_string->GetString()); |
| 311 } | 311 } |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 | 314 |
| 315 PrefFilter::OnWriteCallbackPair PrefHashFilter::GetOnWriteSynchronousCallbacks( | 315 PrefFilter::OnWriteCallbackPair PrefHashFilter::GetOnWriteSynchronousCallbacks( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // which owns the pointers. | 361 // which owns the pointers. |
| 362 HashStoreContents* raw_contents = hash_store_contents_copy.get(); | 362 HashStoreContents* raw_contents = hash_store_contents_copy.get(); |
| 363 base::DictionaryValue* raw_changed_paths_macs = changed_paths_macs.get(); | 363 base::DictionaryValue* raw_changed_paths_macs = changed_paths_macs.get(); |
| 364 | 364 |
| 365 return std::make_pair( | 365 return std::make_pair( |
| 366 base::Bind(&ClearFromExternalStore, base::Unretained(raw_contents), | 366 base::Bind(&ClearFromExternalStore, base::Unretained(raw_contents), |
| 367 base::Unretained(raw_changed_paths_macs)), | 367 base::Unretained(raw_changed_paths_macs)), |
| 368 base::Bind(&FlushToExternalStore, base::Passed(&hash_store_contents_copy), | 368 base::Bind(&FlushToExternalStore, base::Passed(&hash_store_contents_copy), |
| 369 base::Passed(&changed_paths_macs))); | 369 base::Passed(&changed_paths_macs))); |
| 370 } | 370 } |
| OLD | NEW |