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

Unified Diff: chrome/browser/download/download_crx_util.cc

Issue 555323002: Deprecate direct use of legacy extension management preference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/extensions/extension_settings_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_crx_util.cc
diff --git a/chrome/browser/download/download_crx_util.cc b/chrome/browser/download/download_crx_util.cc
index 441c82b9ce889ca61cd2dd6c6eebddf9c0e988c6..b4846c13b573f9e5a248a76c85666167e295be33 100644
--- a/chrome/browser/download/download_crx_util.cc
+++ b/chrome/browser/download/download_crx_util.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
+#include "chrome/browser/extensions/extension_management.h"
#include "chrome/browser/extensions/webstore_installer.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_finder.h"
@@ -16,7 +17,6 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "content/public/browser/download_item.h"
#include "content/public/browser/notification_service.h"
-#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/user_script.h"
@@ -131,10 +131,17 @@ bool IsExtensionDownload(const DownloadItem& download_item) {
}
bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) {
- extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile);
- CHECK(prefs);
+ extensions::ExtensionManagement* extension_management =
+ extensions::ExtensionManagementFactory::GetForBrowserContext(profile);
- extensions::URLPatternSet url_patterns = prefs->GetAllowedInstallSites();
+ // No allowed install sites specified, disallow by default.
binjin 2014/09/09 23:57:51 It turns out that it's how ExtensionInstallSources
Joao da Silva 2014/09/10 10:05:54 I think this is fine. This preference was never me
+ if (!extension_management->ReadGlobalSettings()
+ .has_restricted_install_sources) {
+ return false;
+ }
+
+ const extensions::URLPatternSet& url_patterns =
+ extension_management->ReadGlobalSettings().install_sources;
if (!url_patterns.MatchesURL(item.GetURL()))
return false;
« no previous file with comments | « no previous file | chrome/browser/ui/webui/extensions/extension_settings_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698