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

Unified Diff: chrome/browser/prefs/pref_hash_store_impl.cc

Issue 332473002: Make super MAC optional. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « chrome/browser/prefs/pref_hash_store_impl.h ('k') | chrome/browser/prefs/pref_hash_store_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_hash_store_impl.cc
diff --git a/chrome/browser/prefs/pref_hash_store_impl.cc b/chrome/browser/prefs/pref_hash_store_impl.cc
index 3702bb814c2c9269bf9a50eebf33f5ccb7f11250..270c6d0fa93c7342a80cfd6b2979e3c805f544c2 100644
--- a/chrome/browser/prefs/pref_hash_store_impl.cc
+++ b/chrome/browser/prefs/pref_hash_store_impl.cc
@@ -60,11 +60,15 @@ class PrefHashStoreImpl::PrefHashStoreTransactionImpl
PrefHashStoreImpl::PrefHashStoreImpl(const std::string& seed,
const std::string& device_id,
- scoped_ptr<HashStoreContents> contents)
+ scoped_ptr<HashStoreContents> contents,
+ bool use_super_mac)
: pref_hash_calculator_(seed, device_id),
contents_(contents.Pass()),
initial_hashes_dictionary_trusted_(
- IsHashDictionaryTrusted(pref_hash_calculator_, *contents_)),
+ use_super_mac
+ ? IsHashDictionaryTrusted(pref_hash_calculator_, *contents_)
+ : false),
gab 2014/06/11 18:57:54 What do you think of making the default "true" her
gab 2014/06/11 21:54:32 Actually, never mind. Setting this to false will
+ use_super_mac_(use_super_mac),
has_pending_write_(false) {
DCHECK(contents_);
UMA_HISTOGRAM_BOOLEAN("Settings.HashesDictionaryTrusted",
@@ -98,11 +102,13 @@ PrefHashStoreImpl::PrefHashStoreTransactionImpl::
// Update the super MAC if and only if the hashes dictionary has been
// modified in this transaction.
if (has_changed_) {
- // Get the dictionary of hashes (or NULL if it doesn't exist).
- const base::DictionaryValue* hashes_dict = outer_->contents_->GetContents();
- outer_->contents_->SetSuperMac(outer_->pref_hash_calculator_.Calculate(
- outer_->contents_->hash_store_id(), hashes_dict));
-
+ if (outer_->use_super_mac_) {
+ // Get the dictionary of hashes (or NULL if it doesn't exist).
+ const base::DictionaryValue* hashes_dict =
+ outer_->contents_->GetContents();
+ outer_->contents_->SetSuperMac(outer_->pref_hash_calculator_.Calculate(
+ outer_->contents_->hash_store_id(), hashes_dict));
+ }
outer_->has_pending_write_ = true;
}
@@ -150,7 +156,7 @@ void PrefHashStoreImpl::PrefHashStoreTransactionImpl::StoreHash(
}
bool PrefHashStoreImpl::PrefHashStoreTransactionImpl::StampSuperMac() {
- if (outer_->initial_hashes_dictionary_trusted_)
+ if (!outer_->use_super_mac_ || outer_->initial_hashes_dictionary_trusted_)
gab 2014/06/11 21:54:32 I don't think this is even required since line 104
erikwright (departed) 2014/06/13 13:25:24 This saves us thinking that we have altered the st
gab 2014/06/13 14:48:57 I see, good point :-)!
return false;
has_changed_ = true;
return true;
« no previous file with comments | « chrome/browser/prefs/pref_hash_store_impl.h ('k') | chrome/browser/prefs/pref_hash_store_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698