blob: 823586035d05adce40ea696ce974ddb5d9846f7f [file] [log] [blame]
Dana Friedcb6b1572023-08-18 21:32:011// Copyright 2023 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_USER_EDUCATION_USER_EDUCATION_CONFIGURATION_PROVIDER_H_
6#define CHROME_BROWSER_USER_EDUCATION_USER_EDUCATION_CONFIGURATION_PROVIDER_H_
7
8#include "components/feature_engagement/public/configuration.h"
9#include "components/feature_engagement/public/configuration_provider.h"
10#include "components/feature_engagement/public/feature_list.h"
11#include "components/feature_engagement/public/group_list.h"
12#include "components/user_education/common/feature_promo_registry.h"
13
14// Provides feature engagement configuration based on IPH registered in the
15// browser.
16class UserEducationConfigurationProvider
17 : public feature_engagement::ConfigurationProvider {
18 public:
19 UserEducationConfigurationProvider();
Dana Fried2bb75162023-08-18 21:39:0620 explicit UserEducationConfigurationProvider(
21 user_education::FeaturePromoRegistry registry_for_testing);
Dana Friedcb6b1572023-08-18 21:32:0122 ~UserEducationConfigurationProvider() override;
23
24 // feature_engagement::ConfigurationProvider:
25 bool MaybeProvideFeatureConfiguration(
26 const base::Feature& feature,
27 feature_engagement::FeatureConfig& config,
28 const feature_engagement::FeatureVector& known_features,
29 const feature_engagement::GroupVector& known_groups) const override;
30 const char* GetConfigurationSourceDescription() const override;
31
Dana Fried2bb75162023-08-18 21:39:0632 // For automatic configuration of triggers, derive default "trigger" and
33 // "used" names. The default "used" name, in turn, will be used to ensure that
34 // teams using IPH will be able to call a method that says "this feature was
35 // used" while specifying only the associated `base::Feature`.
36 static std::string GetDefaultTriggerName(const base::Feature& feature);
37 static std::string GetDefaultUsedName(const base::Feature& feature);
38
Dana Friedcb6b1572023-08-18 21:32:0139 private:
40 user_education::FeaturePromoRegistry registry_;
41};
42
43#endif // CHROME_BROWSER_USER_EDUCATION_USER_EDUCATION_CONFIGURATION_PROVIDER_H_