OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 // A utility class for accessing and caching registry preferences that take |
| 6 // the form of lists of strings. |
| 7 // TODO(robertshield): Use the RegistryWatcher stuff to keep this list up to |
| 8 // date. |
| 9 |
| 10 #ifndef CHROME_FRAME_REGISTRY_LIST_PREFERENCES_HOLDER_H_ |
| 11 #define CHROME_FRAME_REGISTRY_LIST_PREFERENCES_HOLDER_H_ |
| 12 #pragma once |
| 13 |
| 14 #include <windows.h> |
| 15 |
| 16 #include <vector> |
| 17 |
| 18 #include "base/string16.h" |
| 19 |
| 20 class RegistryListPreferencesHolder { |
| 21 public: |
| 22 RegistryListPreferencesHolder(); |
| 23 |
| 24 // Initializes the RegistryListPreferencesHolder using the values stored |
| 25 // under the key |list_name| stored at |registry_path| under |hive|. |
| 26 void Init(HKEY hive, |
| 27 const wchar_t* registry_path, |
| 28 const wchar_t* list_name); |
| 29 |
| 30 bool Valid() const { return valid_; } |
| 31 |
| 32 // Returns true iff |string| matches any of the strings in values_, using the |
| 33 // matching logic in base's MatchPattern(). |
| 34 bool ListMatches(const string16& string) const; |
| 35 |
| 36 // Manually add a string to values_ for testing purposes. |
| 37 void AddStringForTesting(const string16& string); |
| 38 |
| 39 // Reset the holder causing it to be re-initialized, for testing purposes |
| 40 // only. |
| 41 // TODO(robertshield): Remove this once the RegistryWatcher stuff is wired up. |
| 42 void ResetForTesting(); |
| 43 |
| 44 private: |
| 45 std::vector<string16> values_; |
| 46 bool valid_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(RegistryListPreferencesHolder); |
| 49 }; |
| 50 |
| 51 #endif // CHROME_FRAME_REGISTRY_LIST_PREFERENCES_HOLDER_H_ |
OLD | NEW |