OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_frame/registry_list_preferences_holder.h" | 5 #include "chrome_frame/registry_list_preferences_holder.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/win/registry.h" | 8 #include "base/win/registry.h" |
9 | 9 |
10 RegistryListPreferencesHolder::RegistryListPreferencesHolder() : valid_(false) { | 10 RegistryListPreferencesHolder::RegistryListPreferencesHolder() : valid_(false) { |
11 } | 11 } |
12 | 12 |
13 void RegistryListPreferencesHolder::Init(HKEY hive, | 13 void RegistryListPreferencesHolder::Init(HKEY hive, |
14 const wchar_t* registry_path, | 14 const wchar_t* registry_path, |
15 const wchar_t* list_name) { | 15 const wchar_t* list_name) { |
16 string16 list_path(registry_path); | 16 base::string16 list_path(registry_path); |
17 list_path += L"\\"; | 17 list_path += L"\\"; |
18 list_path += list_name; | 18 list_path += list_name; |
19 base::win::RegistryValueIterator string_list(hive, list_path.c_str()); | 19 base::win::RegistryValueIterator string_list(hive, list_path.c_str()); |
20 for (; string_list.Valid(); ++string_list) | 20 for (; string_list.Valid(); ++string_list) |
21 values_.push_back(string_list.Name()); | 21 values_.push_back(string_list.Name()); |
22 | 22 |
23 valid_ = true; | 23 valid_ = true; |
24 } | 24 } |
25 | 25 |
26 bool RegistryListPreferencesHolder::ListMatches(const string16& string) const { | 26 bool RegistryListPreferencesHolder::ListMatches(const base::string16& string) |
| 27 const { |
27 DCHECK(Valid()); | 28 DCHECK(Valid()); |
28 std::vector<string16>::const_iterator iter(values_.begin()); | 29 std::vector<base::string16>::const_iterator iter(values_.begin()); |
29 for (; iter != values_.end(); ++iter) { | 30 for (; iter != values_.end(); ++iter) { |
30 if (MatchPattern(string, *iter)) | 31 if (MatchPattern(string, *iter)) |
31 return true; | 32 return true; |
32 } | 33 } |
33 | 34 |
34 return false; | 35 return false; |
35 } | 36 } |
36 | 37 |
37 void RegistryListPreferencesHolder::AddStringForTesting( | 38 void RegistryListPreferencesHolder::AddStringForTesting( |
38 const string16& string) { | 39 const base::string16& string) { |
39 values_.push_back(string); | 40 values_.push_back(string); |
40 } | 41 } |
41 | 42 |
42 void RegistryListPreferencesHolder::ResetForTesting() { | 43 void RegistryListPreferencesHolder::ResetForTesting() { |
43 values_.clear(); | 44 values_.clear(); |
44 valid_ = false; | 45 valid_ = false; |
45 } | 46 } |
OLD | NEW |