Index: services/preferences/tracked/registry_hash_store_contents_win.cc |
diff --git a/services/preferences/tracked/registry_hash_store_contents_win.cc b/services/preferences/tracked/registry_hash_store_contents_win.cc |
index ab1c2c5647857bd219a9ceb8ac3a89e727239a0f..76ee57f3cd1caa8aef225a751e17b6578fac7985 100644 |
--- a/services/preferences/tracked/registry_hash_store_contents_win.cc |
+++ b/services/preferences/tracked/registry_hash_store_contents_win.cc |
@@ -6,10 +6,12 @@ |
#include <windows.h> |
+#include "base/files/scoped_temp_dir.h" |
#include "base/logging.h" |
#include "base/memory/ptr_util.h" |
#include "base/numerics/safe_conversions.h" |
#include "base/strings/string_split.h" |
+#include "base/strings/string_util.h" |
#include "base/strings/stringprintf.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/values.h" |
@@ -71,7 +73,16 @@ bool ClearSplitMac(const base::string16& reg_key_name, |
RegistryHashStoreContentsWin::RegistryHashStoreContentsWin( |
const base::string16& registry_path, |
const base::string16& store_key) |
- : preference_key_name_(registry_path + L"\\PreferenceMACs\\" + store_key) {} |
+ : preference_key_name_(registry_path + L"\\PreferenceMACs\\" + store_key), |
+ reset_on_delete_(base::StartsWith(store_key, |
+ base::ScopedTempDir::GetTempDirPrefix(), |
+ base::CompareCase::INSENSITIVE_ASCII)) { |
+} |
+ |
+RegistryHashStoreContentsWin::~RegistryHashStoreContentsWin() { |
+ if (reset_on_delete_) |
+ Reset(); |
+} |
RegistryHashStoreContentsWin::RegistryHashStoreContentsWin( |
const RegistryHashStoreContentsWin& other) = default; |