Chromium Code Reviews| Index: components/subresource_filter/core/browser/subresource_filter_features.cc |
| diff --git a/components/subresource_filter/core/browser/subresource_filter_features.cc b/components/subresource_filter/core/browser/subresource_filter_features.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b272ef62e3cc3b062575704e838fa74a1a45e48c |
| --- /dev/null |
| +++ b/components/subresource_filter/core/browser/subresource_filter_features.cc |
| @@ -0,0 +1,31 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "components/subresource_filter/core/browser/subresource_filter_features.h" |
| + |
| +#include <string> |
| + |
| +#include "base/strings/string_util.h" |
| +#include "components/variations/variations_associated_data.h" |
| + |
| +namespace subresource_filter { |
| + |
| +const base::Feature kSafeBrowsingSubresourceFilter{ |
|
battre
2016/05/30 15:29:25
nit: space before { ?
engedy
2016/05/30 20:54:00
Agreed that it looks horrible, but clang-format do
|
| + "SubresourceFilter", base::FEATURE_DISABLED_BY_DEFAULT}; |
| + |
| +const char kActivationStateParameterName[] = "activation_state"; |
| +const char kActivationStateDryRun[] = "dryrun"; |
| +const char kActivationStateEnabled[] = "enabled"; |
| + |
| +ActivationState GetMaximumActivationState() { |
| + std::string activation_state = variations::GetVariationParamValueByFeature( |
| + kSafeBrowsingSubresourceFilter, kActivationStateParameterName); |
| + if (base::LowerCaseEqualsASCII(activation_state, kActivationStateEnabled)) |
| + return ActivationState::ENABLED; |
| + else if (base::LowerCaseEqualsASCII(activation_state, kActivationStateDryRun)) |
| + return ActivationState::DRYRUN; |
| + return ActivationState::DISABLED; |
| +} |
| + |
| +} // namespace subresource_filter |