Commit 9d7ae4d5 authored by rdevlin.cronin's avatar rdevlin.cronin Committed by Commit bot

[Reland][Extensions] Enable sideloading prompt on mac on canary

Reverted due to compile error; now fixed.

BUG=669277

Review-Url: https://codereview.chromium.org/2635443002
Cr-Commit-Position: refs/heads/master@{#443576}
parent f04d7724
......@@ -2258,7 +2258,7 @@ int ExtensionService::GetDisableReasonsOnInstalled(const Extension* extension) {
: disable_reasons;
}
if (FeatureSwitch::prompt_for_external_extensions()->IsEnabled()) {
if (extensions::ExternalInstallManager::IsPromptingEnabled()) {
// External extensions are initially disabled. We prompt the user before
// enabling them. Hosted apps are excepted because they are not dangerous
// (they need to be launched by the user anyway). We also don't prompt for
......
......@@ -12,12 +12,14 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/external_install_error.h"
#include "chrome/browser/profiles/profile.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h"
#include "extensions/common/feature_switch.h"
#include "extensions/common/features/feature_channel.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_url_handlers.h"
......@@ -84,6 +86,16 @@ ExternalInstallManager::ExternalInstallManager(
ExternalInstallManager::~ExternalInstallManager() {
}
bool ExternalInstallManager::IsPromptingEnabled() {
// Enable this feature on canary on mac.
#if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD)
return GetCurrentChannel() <= version_info::Channel::CANARY;
#else
return FeatureSwitch::prompt_for_external_extensions()->IsEnabled();
#endif
}
void ExternalInstallManager::AddExternalInstallError(const Extension* extension,
bool is_new_profile) {
// Error already exists or has been previously shown.
......@@ -116,7 +128,7 @@ void ExternalInstallManager::RemoveExternalInstallError(
void ExternalInstallManager::UpdateExternalExtensionAlert() {
// If the feature is not enabled do nothing.
if (!FeatureSwitch::prompt_for_external_extensions()->IsEnabled())
if (!IsPromptingEnabled())
return;
// Look for any extensions that were disabled because of being unacknowledged
......@@ -219,7 +231,7 @@ void ExternalInstallManager::OnExtensionUninstalled(
bool ExternalInstallManager::IsUnacknowledgedExternalExtension(
const Extension& extension) const {
if (!FeatureSwitch::prompt_for_external_extensions()->IsEnabled())
if (!IsPromptingEnabled())
return false;
int disable_reasons = extension_prefs_->GetDisableReasons(extension.id());
......
......@@ -34,6 +34,9 @@ class ExternalInstallManager : public ExtensionRegistryObserver,
bool is_first_run);
~ExternalInstallManager() override;
// Returns true if prompting for external extensions is enabled.
static bool IsPromptingEnabled();
// Removes the error associated with a given extension.
void RemoveExternalInstallError(const std::string& extension_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment