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

Unified Diff: extensions/browser/extension_prefs.cc

Issue 2054773002: Replace the WAS_INSTALLED_BY_CUSTODIAN creation flag with a pref (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to code review by treib@ Created 4 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: extensions/browser/extension_prefs.cc
diff --git a/extensions/browser/extension_prefs.cc b/extensions/browser/extension_prefs.cc
index f18fad80e3d2020704f25d8482d0aedc3852167c..7333297f072dc3e6b64bf6e894b84aa61b999115 100644
--- a/extensions/browser/extension_prefs.cc
+++ b/extensions/browser/extension_prefs.cc
@@ -122,6 +122,10 @@ const char kPrefAllowFileAccess[] = "newAllowFileAccess";
// the old flag and possibly go back to that name.
// const char kPrefAllowFileAccessOld[] = "allowFileAccess";
+// A preference that is relevant only for supervised users
+// and used to flag an extension as installed by custodian.
+const char kPrefWasInstalledByCustodian[] = "wasInstalledByCustodian";
+
// A preference specifying if the user dragged the app on the NTP.
const char kPrefUserDraggedApp[] = "user_dragged_app_ntp";
@@ -1041,6 +1045,17 @@ bool ExtensionPrefs::HasAllowFileAccessSetting(
return ext && ext->HasKey(kPrefAllowFileAccess);
}
+bool ExtensionPrefs::WasInstalledByCustodian(
+ const std::string& extension_id) const {
+ return ReadPrefAsBooleanAndReturn(extension_id, kPrefWasInstalledByCustodian);
+}
+
+void ExtensionPrefs::SetWasInstalledByCustodian(const std::string& extension_id,
+ bool installed_by_custodian) {
+ UpdateExtensionPref(extension_id, kPrefWasInstalledByCustodian,
+ new base::FundamentalValue(installed_by_custodian));
+}
+
bool ExtensionPrefs::DoesExtensionHaveState(
const std::string& id, Extension::State check_state) const {
const base::DictionaryValue* extension = GetExtensionPref(id);
« extensions/browser/extension_prefs.h ('K') | « extensions/browser/extension_prefs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698