Sorry for the delay -- Short term, I think that Jason's proposed solution will work for this; the idea is to use
FeatureList::IsFeatureOverriddenFromCommandLine to effectively make a tri-state that can differentiate between the feature being on-by default and the feature being on by user-declaration.
So, in runtime_features.cc, instead of this:
if (!base::FeatureList::IsEnabled(features::kWebUsb))
WebRuntimeFeatures::enableWebUsb(false);
We propose something like this:
if (!base::FeatureList:: IsFeatureOverriddenFromCommandLine(
features::kWebUsb,
FeatureList::OVERRIDE_ENABLE_FEATURE)) WebRuntimeFeatures::enableWebUsb(false); // Allow origin trials to turn on as needed
I'd also move that to the top of the function, so that the ExperimentalWebPlatformFeatures flag can also turn WebUSB on, as it should. (I think)
Then when you need to determine in browser code whether the feature should be active (including whether the kill switch has been used), just test base::FeatureList::IsEnabled(features::kWebUsb).
There's still a possibility that--even when the kill switch is thrown--the bindings still get generated if a valid trial token is present. (Depending on the implementation, that may not be a serious problem; if you're always assuming that the renderer is untrusted, then you've probably already dealt with the fact that the renderer might try to call into the browser side even if the feature is disabled there)
We can still mitigate that -- we might have to tie the new disabled-feature-list in chrome/common/origin_trials/origin_trial_policy to the kill switch / FeautreList as well, to ensure that doesn't happen. That's on me, though.
Let me know if that makes sense, or if I've still missed something important.
Thanks,
Ian