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

Unified Diff: chrome/browser/extensions/extension_util.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: chrome/browser/extensions/extension_util.cc
diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc
index 4a861653b6ebb4e3906532324f16a8e501d3f259..be4a7709313fbfd8da136d7b0c42388dabefc9bd 100644
--- a/chrome/browser/extensions/extension_util.cc
+++ b/chrome/browser/extensions/extension_util.cc
@@ -220,6 +220,21 @@ void SetAllowFileAccess(const std::string& extension_id,
ReloadExtensionIfEnabled(extension_id, context);
}
+void SetWasInstalledByCustodian(const std::string& extension_id,
+ content::BrowserContext* context,
+ bool installed_by_custodian) {
+ const Extension* extension =
+ ExtensionRegistry::Get(context)->GetInstalledExtension(extension_id);
+ if (extension &&
+ installed_by_custodian == extension->was_installed_by_custodian())
+ return;
+ ExtensionPrefs::Get(context)->SetWasInstalledByCustodian(
+ extension_id, installed_by_custodian);
+ ExtensionService* service =
+ ExtensionSystem::Get(context)->extension_service();
+ service->ReloadExtension(extension_id);
Marc Treib 2016/06/13 12:17:09 Maybe add a comment on why the reload is necessary
mamir 2016/06/13 14:15:57 Done.
+}
+
bool AllowedScriptingOnAllUrls(const std::string& extension_id,
content::BrowserContext* context) {
bool allowed = false;

Powered by Google App Engine
This is Rietveld 408576698