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

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: Fix the bug of delegated installs for pre-existing extensions 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..7fed3b52d32e015c978c81c4752787e4ff17d873 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 kPrefIsInstalledByCustodian[] = "isInstalledByCustodian";
+
// A preference specifying if the user dragged the app on the NTP.
const char kPrefUserDraggedApp[] = "user_dragged_app_ntp";
@@ -1041,6 +1045,23 @@ bool ExtensionPrefs::HasAllowFileAccessSetting(
return ext && ext->HasKey(kPrefAllowFileAccess);
}
+bool ExtensionPrefs::IsInstalledByCustodian(
+ const std::string& extension_id) const {
+ return ReadPrefAsBooleanAndReturn(extension_id, kPrefIsInstalledByCustodian);
+}
+
+void ExtensionPrefs::SetIsInstalledByCustodian(const std::string& extension_id,
+ bool installed_by_custodian) {
+ UpdateExtensionPref(extension_id, kPrefIsInstalledByCustodian,
+ new base::FundamentalValue(installed_by_custodian));
+}
+
+bool ExtensionPrefs::HasIsInstalledByCustodianSetting(
+ const std::string& extension_id) const {
+ const base::DictionaryValue* ext = GetExtensionPref(extension_id);
+ return ext && ext->HasKey(kPrefIsInstalledByCustodian);
+}
+
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