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

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

Issue 2004043002: Supervised Users Initiated Installs v2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kid_initiated_install
Patch Set: Fixing the build again! 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: chrome/browser/extensions/extension_util.cc
diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc
index 4c019be7b86784d0c95a53a011f50a5fb73532be..76e9a832b9675e15f969571632c9885b66e37d6a 100644
--- a/chrome/browser/extensions/extension_util.cc
+++ b/chrome/browser/extensions/extension_util.cc
@@ -235,12 +235,9 @@ void SetWasInstalledByCustodian(const std::string& extension_id,
ExtensionPrefs::Get(context)->UpdateExtensionPref(
extension_id, kWasInstalledByCustodianPrefName,
installed_by_custodian ? new base::FundamentalValue(true) : nullptr);
- ExtensionRegistry* registry = ExtensionRegistry::Get(context);
- const Extension* extension = registry->GetInstalledExtension(extension_id);
ExtensionService* service =
ExtensionSystem::Get(context)->extension_service();
- // If the installed_by_custodian flag is reset, do nothing.
if (!installed_by_custodian) {
// If installed_by_custodian changes to false, the extension may need to
// be unloaded now.
@@ -248,6 +245,7 @@ void SetWasInstalledByCustodian(const std::string& extension_id,
return;
}
+ ExtensionRegistry* registry = ExtensionRegistry::Get(context);
// If it is already enabled, do nothing.
if (registry->enabled_extensions().Contains(extension_id))
return;
@@ -255,7 +253,7 @@ void SetWasInstalledByCustodian(const std::string& extension_id,
// If the extension is not loaded, it may need to be reloaded.
// Example is a pre-installed extension that was unloaded when a
// supervised user flag has been received.
- if (!extension) {
+ if (!registry->GetInstalledExtension(extension_id)) {
service->ReloadExtension(extension_id);
}
}

Powered by Google App Engine
This is Rietveld 408576698