blob: f2e756e0494de54c7b2c59b4bd0f4c4e699ee321 [file] [log] [blame]
// Copyright 2017 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 "base/macros.h"
#include "components/feature_engagement/public/configuration.h"
#include "components/feature_engagement/public/feature_list.h"
namespace base {
struct Feature;
} // namespace base
namespace feature_engagement {
// A ChromeVariationsConfiguration provides a configuration that is parsed from
// Chrome variations feature params. It is required to call
// ParseFeatureConfigs(...) with all the features that should be parsed.
class ChromeVariationsConfiguration : public Configuration {
~ChromeVariationsConfiguration() override;
// Configuration implementation.
const FeatureConfig& GetFeatureConfig(
const base::Feature& feature) const override;
const FeatureConfig& GetFeatureConfigByName(
const std::string& feature_name) const override;
const Configuration::ConfigMap& GetRegisteredFeatureConfigs() const override;
const std::vector<std::string> GetRegisteredFeatures() const override;
// Parses the variations configuration for all of the given |features| and
// stores the result. It is only valid to call ParseFeatureConfig once.
void ParseFeatureConfigs(const FeatureVector& features);
void ParseFeatureConfig(const base::Feature* feature,
const FeatureVector& all_features);
// Returns true if FeatureConfig was found with a local hard coded
// configuration.
bool MaybeAddClientSideFeatureConfig(const base::Feature* feature);
// The current configurations.
ConfigMap configs_;
} // namespace feature_engagement