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

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

Issue 2668863002: [Extensions] Remove FeatureSwitch::easy_off_store_install (Closed)
Patch Set: Add TODO for histograms 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
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 ||
+ 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

Powered by Google App Engine
This is Rietveld 408576698