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

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

Issue 2668863002: [Extensions] Remove FeatureSwitch::easy_off_store_install (Closed)
Patch Set: . Created 3 years, 11 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 | « chrome/browser/download/download_crx_util.h ('k') | chrome/browser/download/download_target_determiner.cc » ('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 13fd68e000ec1481d208544447980011e902522e..a7fa2a7a5f74924156d2c03d3157ce2cf18fa9e6 100644
--- a/chrome/browser/download/download_crx_util.cc
+++ b/chrome/browser/download/download_crx_util.cc
@@ -27,6 +27,8 @@ namespace download_crx_util {
namespace {
+bool g_allow_offstore_install_for_testing = false;
+
// Hold a mock ExtensionInstallPrompt object that will be used when the
// download system opens a CRX.
ExtensionInstallPrompt* mock_install_prompt_for_testing = NULL;
@@ -131,8 +133,15 @@ bool OffStoreInstallAllowedByPrefs(Profile* profile, const DownloadItem& item) {
// 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 extensions::ExtensionManagementFactory::GetForBrowserContext(profile)
- ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl());
+ return g_allow_offstore_install_for_testing ||
Devlin 2017/02/01 17:17:42 pastarmovj@: I'd rather just have tests set the pr
Devlin 2017/02/06 17:22:33 Since this is still better than the current comple
pastarmovj 2017/02/07 06:49:06 Hey sorry I somehow missed this request. You can c
+ extensions::ExtensionManagementFactory::GetForBrowserContext(profile)
+ ->IsOffstoreInstallAllowed(item.GetURL(), item.GetReferrerUrl());
+}
+
+std::unique_ptr<base::AutoReset<bool>> OverrideOffstoreInstallAllowedForTesting(
+ bool allowed) {
+ return base::MakeUnique<base::AutoReset<bool>>(
+ &g_allow_offstore_install_for_testing, allowed);
}
} // namespace download_crx_util
« no previous file with comments | « chrome/browser/download/download_crx_util.h ('k') | chrome/browser/download/download_target_determiner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698