Commit d6551ba2 authored by Domenic Denicola's avatar Domenic Denicola Committed by Commit Bot

Origin policy: fix up feature flag handling

Previously most parts of the code would check if origin policy was enabled, but one part would check if origin policy was enabled *or* if experimental web platform features was enabled. The intention is to have experimental web platform features imply origin policy, which can be done through content_switch_dependent_feature_overrides, and then only having to check if origin policy is enabled.

Bug: 751996
Change-Id: I2da004e77ecc8b72e426b8c62ab944837a92d6a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2063046Reviewed-by: default avatarLily Chen <chlily@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Domenic Denicola <domenic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742862}
parent 2bce96e4
......@@ -34,11 +34,7 @@ void OriginPolicyAddExceptionFor(BrowserContext* browser_context,
// static
bool OriginPolicyThrottle::ShouldRequestOriginPolicy(const GURL& url) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
bool origin_policy_enabled =
base::FeatureList::IsEnabled(features::kOriginPolicy) ||
base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExperimentalWebPlatformFeatures);
if (!origin_policy_enabled)
if (!base::FeatureList::IsEnabled(features::kOriginPolicy))
return false;
if (!url.SchemeIs(url::kHttpsScheme))
......
......@@ -37,6 +37,9 @@ GetSwitchDependentFeatureOverrides(const base::CommandLine& command_line) {
{switches::kEnableExperimentalWebPlatformFeatures,
std::cref(features::kUserAgentClientHint),
base::FeatureList::OVERRIDE_ENABLE_FEATURE},
{switches::kEnableExperimentalWebPlatformFeatures,
std::cref(features::kOriginPolicy),
base::FeatureList::OVERRIDE_ENABLE_FEATURE},
};
// TODO(chlily): There are currently a few places where, to check if some
......
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