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

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: fixes addressing #12 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/extensions/extension_management.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..28ba4ab6b0477f80a1a7ef93287ba9235700b432 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,21 +131,11 @@ bool IsExtensionDownload(const DownloadItem& download_item) {
}
bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) {
- extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile);
- CHECK(prefs);
-
- extensions::URLPatternSet url_patterns = prefs->GetAllowedInstallSites();
-
- if (!url_patterns.MatchesURL(item.GetURL()))
- return false;
-
- // The referrer URL must also be whitelisted, unless the URL has the file
- // scheme (there's no referrer for those URLs).
// TODO(aa): RefererURL is cleared in some cases, for example when going
// between secure and non-secure URLs. It would be better if DownloadItem
// tracked the initiating page explicitly.
- return url_patterns.MatchesURL(item.GetReferrerUrl()) ||
- item.GetURL().SchemeIsFile();
+ return extensions::ExtensionManagementFactory::GetForBrowserContext(profile)
+ ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl());
}
} // namespace download_crx_util
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_management.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698