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 "chrome/browser/prefs/pref_hash_store_impl.h" | 5 #include "chrome/browser/prefs/pref_hash_store_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 NOTREACHED() << "Unexpected PrefHashCalculator::ValidationResult: " | 51 NOTREACHED() << "Unexpected PrefHashCalculator::ValidationResult: " |
52 << validation_result; | 52 << validation_result; |
53 return PrefHashStore::UNKNOWN_VALUE; | 53 return PrefHashStore::UNKNOWN_VALUE; |
54 } | 54 } |
55 | 55 |
56 void PrefHashStoreImpl::StoreHash( | 56 void PrefHashStoreImpl::StoreHash( |
57 const std::string& path, const base::Value* new_value) { | 57 const std::string& path, const base::Value* new_value) { |
58 { | 58 { |
59 DictionaryPrefUpdate update(local_state_, prefs::kProfilePreferenceHashes); | 59 DictionaryPrefUpdate update(local_state_, prefs::kProfilePreferenceHashes); |
60 DictionaryValue* child_dictionary = NULL; | 60 base::DictionaryValue* child_dictionary = NULL; |
61 | 61 |
62 // Get the dictionary corresponding to the profile name, which may have a | 62 // Get the dictionary corresponding to the profile name, which may have a |
63 // '.' | 63 // '.' |
64 if (!update->GetDictionaryWithoutPathExpansion(hash_store_id_, | 64 if (!update->GetDictionaryWithoutPathExpansion(hash_store_id_, |
65 &child_dictionary)) { | 65 &child_dictionary)) { |
66 child_dictionary = new DictionaryValue; | 66 child_dictionary = new base::DictionaryValue; |
67 update->SetWithoutPathExpansion(hash_store_id_, child_dictionary); | 67 update->SetWithoutPathExpansion(hash_store_id_, child_dictionary); |
68 } | 68 } |
69 | 69 |
70 child_dictionary->SetString( | 70 child_dictionary->SetString( |
71 path, pref_hash_calculator_.Calculate(path, new_value)); | 71 path, pref_hash_calculator_.Calculate(path, new_value)); |
72 } | 72 } |
73 // TODO(erikwright): During tests, pending writes were still waiting when the | 73 // TODO(erikwright): During tests, pending writes were still waiting when the |
74 // IO thread is already gone. Consider other solutions. | 74 // IO thread is already gone. Consider other solutions. |
75 local_state_->CommitPendingWrite(); | 75 local_state_->CommitPendingWrite(); |
76 } | 76 } |
OLD | NEW |