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

Unified Diff: chrome_frame/registry_list_preferences_holder.cc

Issue 9720001: Add a setting to CF to remove 'chromeframe' from the UserAgent on a per-pattern basis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: In the end. Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_frame/registry_list_preferences_holder.h ('k') | chrome_frame/test/html_util_unittests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/registry_list_preferences_holder.cc
diff --git a/chrome_frame/registry_list_preferences_holder.cc b/chrome_frame/registry_list_preferences_holder.cc
new file mode 100644
index 0000000000000000000000000000000000000000..581aed66f1f02e3b0fa7ca0d5e33ae7f4b3e7f45
--- /dev/null
+++ b/chrome_frame/registry_list_preferences_holder.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome_frame/registry_list_preferences_holder.h"
+
+#include "base/string_util.h"
+#include "base/win/registry.h"
+
+RegistryListPreferencesHolder::RegistryListPreferencesHolder() : valid_(false) {
+}
+
+void RegistryListPreferencesHolder::Init(HKEY hive,
+ const wchar_t* registry_path,
+ const wchar_t* list_name) {
+ string16 list_path(registry_path);
+ list_path += L"\\";
+ list_path += list_name;
+ base::win::RegistryValueIterator string_list(hive, list_path.c_str());
+ for (; string_list.Valid(); ++string_list)
+ values_.push_back(string_list.Name());
+
+ valid_ = true;
+}
+
+bool RegistryListPreferencesHolder::ListMatches(const string16& string) const {
+ DCHECK(Valid());
+ std::vector<string16>::const_iterator iter(values_.begin());
+ for (; iter != values_.end(); ++iter) {
+ if (MatchPattern(string, *iter))
+ return true;
+ }
+
+ return false;
+}
+
+void RegistryListPreferencesHolder::AddStringForTesting(
+ const string16& string) {
+ values_.push_back(string);
+}
+
+void RegistryListPreferencesHolder::ResetForTesting() {
+ values_.clear();
+ valid_ = false;
+}
« no previous file with comments | « chrome_frame/registry_list_preferences_holder.h ('k') | chrome_frame/test/html_util_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698