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

Side by Side Diff: services/preferences/tracked/registry_hash_store_contents_win.cc

Issue 2893703002: Cleanup PreferenceMACs on browser_tests startup (Closed)
Patch Set: fix compile Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 "services/preferences/tracked/registry_hash_store_contents_win.h" 5 #include "services/preferences/tracked/registry_hash_store_contents_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/files/scoped_temp_dir.h"
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
11 #include "base/numerics/safe_conversions.h" 12 #include "base/numerics/safe_conversions.h"
12 #include "base/strings/string_split.h" 13 #include "base/strings/string_split.h"
14 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
14 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
15 #include "base/values.h" 17 #include "base/values.h"
16 #include "base/win/registry.h" 18 #include "base/win/registry.h"
17 #include "services/preferences/public/cpp/tracked/tracked_preference_histogram_n ames.h" 19 #include "services/preferences/public/cpp/tracked/tracked_preference_histogram_n ames.h"
18 20
19 using base::win::RegistryValueIterator; 21 using base::win::RegistryValueIterator;
20 22
21 namespace { 23 namespace {
22 24
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return key.DeleteKey(L"") == ERROR_SUCCESS; 66 return key.DeleteKey(L"") == ERROR_SUCCESS;
65 } 67 }
66 return false; 68 return false;
67 } 69 }
68 70
69 } // namespace 71 } // namespace
70 72
71 RegistryHashStoreContentsWin::RegistryHashStoreContentsWin( 73 RegistryHashStoreContentsWin::RegistryHashStoreContentsWin(
72 const base::string16& registry_path, 74 const base::string16& registry_path,
73 const base::string16& store_key) 75 const base::string16& store_key)
74 : preference_key_name_(registry_path + L"\\PreferenceMACs\\" + store_key) {} 76 : preference_key_name_(registry_path + L"\\PreferenceMACs\\" + store_key),
77 reset_on_delete_(base::StartsWith(store_key,
78 base::ScopedTempDir::GetTempDirPrefix(),
79 base::CompareCase::INSENSITIVE_ASCII)) {
80 }
81
82 RegistryHashStoreContentsWin::~RegistryHashStoreContentsWin() {
83 if (reset_on_delete_)
84 Reset();
85 }
75 86
76 RegistryHashStoreContentsWin::RegistryHashStoreContentsWin( 87 RegistryHashStoreContentsWin::RegistryHashStoreContentsWin(
77 const RegistryHashStoreContentsWin& other) = default; 88 const RegistryHashStoreContentsWin& other) = default;
78 89
79 bool RegistryHashStoreContentsWin::IsCopyable() const { 90 bool RegistryHashStoreContentsWin::IsCopyable() const {
80 return true; 91 return true;
81 } 92 }
82 93
83 std::unique_ptr<HashStoreContents> RegistryHashStoreContentsWin::MakeCopy() 94 std::unique_ptr<HashStoreContents> RegistryHashStoreContentsWin::MakeCopy()
84 const { 95 const {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 std::string RegistryHashStoreContentsWin::GetSuperMac() const { 184 std::string RegistryHashStoreContentsWin::GetSuperMac() const {
174 NOTREACHED() 185 NOTREACHED()
175 << "RegistryHashStoreContents does not support the GetSuperMac operation"; 186 << "RegistryHashStoreContents does not support the GetSuperMac operation";
176 return NULL; 187 return NULL;
177 } 188 }
178 189
179 void RegistryHashStoreContentsWin::SetSuperMac(const std::string& super_mac) { 190 void RegistryHashStoreContentsWin::SetSuperMac(const std::string& super_mac) {
180 NOTREACHED() 191 NOTREACHED()
181 << "RegistryHashStoreContents does not support the SetSuperMac operation"; 192 << "RegistryHashStoreContents does not support the SetSuperMac operation";
182 } 193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698