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

Unified Diff: chrome/browser/extensions/extension_prefs.cc

Issue 10542048: Add a group policy controlling which sites can install extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: yozments Created 8 years, 6 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/extensions/extension_prefs.cc
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
index 41c10171a5dee562a3c3b21bb4a7450a7e186720..925c9ffed21b66aa5381ab3175ae89e4e7c17c5d 100644
--- a/chrome/browser/extensions/extension_prefs.cc
+++ b/chrome/browser/extensions/extension_prefs.cc
@@ -1904,6 +1904,28 @@ void ExtensionPrefs::ClearIncognitoSessionOnlyContentSettings() {
}
}
+URLPatternSet ExtensionPrefs::GetAllowedInstallSites() {
+ URLPatternSet result;
+ const ListValue* list = prefs_->GetList(prefs::kExtensionAllowedInstallSites);
+ if (!list)
Mattias Nissler (ping if slow) 2012/06/08 09:38:22 This NULL check is not necessary as pref service w
+ return result;
+
+ for (size_t i = 0; i < list->GetSize(); ++i) {
+ std::string entry_string;
+ URLPattern entry(URLPattern::SCHEME_ALL);
+ if (!list->GetString(i, &entry_string) ||
+ entry.Parse(entry_string) != URLPattern::PARSE_SUCCESS) {
+ LOG(ERROR) << "Invalid value for preference: "
+ << prefs::kExtensionAllowedInstallSites
+ << "." << i;
+ continue;
+ }
+ result.AddPattern(entry);
+ }
+
+ return result;
+}
+
// static
void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterDictionaryPref(kExtensionsPref, PrefService::UNSYNCABLE_PREF);
@@ -1931,4 +1953,6 @@ void ExtensionPrefs::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterInt64Pref(prefs::kNextExtensionsUpdateCheck,
0, // default value
PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterListPref(prefs::kExtensionAllowedInstallSites,
+ PrefService::UNSYNCABLE_PREF);
}

Powered by Google App Engine
This is Rietveld 408576698