| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_EDITABLE_CONFIGURATION_H_ | 5 #ifndef COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_EDITABLE_CONFIGURATION_H_ |
| 6 #define COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_EDITABLE_CONFIGURATION_H_ | 6 #define COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_EDITABLE_CONFIGURATION_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "components/feature_engagement_tracker/internal/configuration.h" | 9 #include "components/feature_engagement_tracker/internal/configuration.h" |
| 10 | 10 |
| 11 namespace base { | 11 namespace base { |
| 12 struct Feature; | 12 struct Feature; |
| 13 } // namespace base | 13 } // namespace base |
| 14 | 14 |
| 15 namespace feature_engagement_tracker { | 15 namespace feature_engagement_tracker { |
| 16 | 16 |
| 17 // An EditableConfiguration provides a configuration that can be configured | 17 // An EditableConfiguration provides a configuration that can be configured |
| 18 // by calling SetConfiguration(...) for each feature, which makes it well | 18 // by calling SetConfiguration(...) for each feature, which makes it well |
| 19 // suited for simple setup and tests. | 19 // suited for simple setup and tests. |
| 20 class EditableConfiguration : public Configuration { | 20 class EditableConfiguration : public Configuration { |
| 21 public: | 21 public: |
| 22 EditableConfiguration(); | 22 EditableConfiguration(); |
| 23 ~EditableConfiguration() override; | 23 ~EditableConfiguration() override; |
| 24 | 24 |
| 25 // Configuration implementaiton. | 25 // Configuration implementation. |
| 26 const FeatureConfig& GetFeatureConfig( | 26 const FeatureConfig& GetFeatureConfig( |
| 27 const base::Feature& feature) const override; | 27 const base::Feature& feature) const override; |
| 28 const Configuration::ConfigMap& GetRegisteredFeatures() const override; |
| 28 | 29 |
| 29 // Adds a new FeatureConfig to the current configurations. If it already | 30 // Adds a new FeatureConfig to the current configurations. If it already |
| 30 // exists, the contents are replaced. | 31 // exists, the contents are replaced. |
| 31 void SetConfiguration(const base::Feature* feature, | 32 void SetConfiguration(const base::Feature* feature, |
| 32 const FeatureConfig& feature_config); | 33 const FeatureConfig& feature_config); |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 // The current configurations. | 36 // The current configurations. |
| 36 ConfigMap configs_; | 37 ConfigMap configs_; |
| 37 | 38 |
| 38 DISALLOW_COPY_AND_ASSIGN(EditableConfiguration); | 39 DISALLOW_COPY_AND_ASSIGN(EditableConfiguration); |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 } // namespace feature_engagement_tracker | 42 } // namespace feature_engagement_tracker |
| 42 | 43 |
| 43 #endif // COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_EDITABLE_CONFIGURATION
_H_ | 44 #endif // COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_EDITABLE_CONFIGURATION
_H_ |
| OLD | NEW |