1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome_frame/registry_list_preferences_holder.h"
7 #include "base/string_util.h"
8 #include "base/win/registry.h"
10 RegistryListPreferencesHolder::RegistryListPreferencesHolder() : valid_(false) {
13 void RegistryListPreferencesHolder::Init(HKEY hive
,
14 const wchar_t* registry_path
,
15 const wchar_t* list_name
) {
16 string16
list_path(registry_path
);
18 list_path
+= list_name
;
19 base::win::RegistryValueIterator
string_list(hive
, list_path
.c_str());
20 for (; string_list
.Valid(); ++string_list
)
21 values_
.push_back(string_list
.Name());
26 bool RegistryListPreferencesHolder::ListMatches(const string16
& string
) const {
28 std::vector
<string16
>::const_iterator
iter(values_
.begin());
29 for (; iter
!= values_
.end(); ++iter
) {
30 if (MatchPattern(string
, *iter
))
37 void RegistryListPreferencesHolder::AddStringForTesting(
38 const string16
& string
) {
39 values_
.push_back(string
);
42 void RegistryListPreferencesHolder::ResetForTesting() {