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

Unified Diff: chrome/browser/policy/configuration_policy_handler.cc

Issue 10908226: Introduces a search term extraction mechanism working for arbitrary search providers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Indent fix. Created 8 years, 2 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
Index: chrome/browser/policy/configuration_policy_handler.cc
diff --git a/chrome/browser/policy/configuration_policy_handler.cc b/chrome/browser/policy/configuration_policy_handler.cc
index cf8dfd3c16c63897e39b7fd85c3e6848bb7f65fa..709e2e0bf4112abd583ae3ce9d358cbb5416d131 100644
--- a/chrome/browser/policy/configuration_policy_handler.cc
+++ b/chrome/browser/policy/configuration_policy_handler.cc
@@ -89,6 +89,9 @@ const DefaultSearchSimplePolicyHandlerEntry kDefaultSearchPolicyMap[] = {
{ key::kDefaultSearchProviderEncodings,
prefs::kDefaultSearchProviderEncodings,
Value::TYPE_LIST },
+ { key::kDefaultSearchProviderAlternateURLs,
+ prefs::kDefaultSearchProviderAlternateURLs,
+ Value::TYPE_LIST },
};
// List of entries determining which proxy policies can be specified, depending
@@ -651,6 +654,8 @@ void DefaultSearchPolicyHandler::ApplyPolicySettings(const PolicyMap& policies,
prefs->SetString(prefs::kDefaultSearchProviderEncodings, std::string());
prefs->SetString(prefs::kDefaultSearchProviderKeyword, std::string());
prefs->SetString(prefs::kDefaultSearchProviderInstantURL, std::string());
+ prefs->SetValue(prefs::kDefaultSearchProviderAlternateURLs,
+ new ListValue());
} else {
// The search URL is required. The other entries are optional. Just make
// sure that they are all specified via policy, so that the regular prefs
@@ -667,6 +672,7 @@ void DefaultSearchPolicyHandler::ApplyPolicySettings(const PolicyMap& policies,
EnsureStringPrefExists(prefs, prefs::kDefaultSearchProviderEncodings);
EnsureStringPrefExists(prefs, prefs::kDefaultSearchProviderKeyword);
EnsureStringPrefExists(prefs, prefs::kDefaultSearchProviderInstantURL);
+ EnsureListPrefExists(prefs, prefs::kDefaultSearchProviderAlternateURLs);
// For the name and keyword, default to the host if not specified. If
// there is no host (file: URLs? Not sure), use "_" to guarantee that the
@@ -753,6 +759,15 @@ void DefaultSearchPolicyHandler::EnsureStringPrefExists(
prefs->SetString(path, value);
}
+void DefaultSearchPolicyHandler::EnsureListPrefExists(
+ PrefValueMap* prefs,
+ const std::string& path) {
+ base::Value* value;
+ base::ListValue* list_value;
+ if (!prefs->GetValue(path, &value) || !value->GetAsList(&list_value))
+ prefs->SetValue(path, new ListValue());
+}
+
// ProxyPolicyHandler implementation -------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698