Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: components/feature_engagement_tracker/internal/condition_validator.h

Issue 2911123003: Metrics for feature engagement tracker. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_CONDITION_VALIDATOR_H_ 5 #ifndef COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_CONDITION_VALIDATOR_H_
6 #define COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_CONDITION_VALIDATOR_H_ 6 #define COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_CONDITION_VALIDATOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 15 matching lines...) Expand all
26 class ConditionValidator { 26 class ConditionValidator {
27 public: 27 public:
28 // The Result struct is used to categorize everything that could have the 28 // The Result struct is used to categorize everything that could have the
29 // wrong state. By returning an instance of this where every value is true 29 // wrong state. By returning an instance of this where every value is true
30 // from MeetsConditions(...), it can be assumed that in-product help will 30 // from MeetsConditions(...), it can be assumed that in-product help will
31 // be displayed. 31 // be displayed.
32 struct Result { 32 struct Result {
33 explicit Result(bool initial_values); 33 explicit Result(bool initial_values);
34 Result(const Result& other); 34 Result(const Result& other);
35 35
36 // Whether the Model was ready. 36 // Whether the event model was ready.
37 bool model_ready_ok; 37 bool event_model_ready_ok;
38 38
39 // Whether no other in-product helps were shown at the time. 39 // Whether no other in-product helps were shown at the time.
40 bool currently_showing_ok; 40 bool currently_showing_ok;
41 41
42 // Whether the feature is enabled. 42 // Whether the feature is enabled.
43 bool feature_enabled_ok; 43 bool feature_enabled_ok;
44 44
45 // Whether the feature configuration was valid. 45 // Whether the feature configuration was valid.
46 bool config_ok; 46 bool config_ok;
47 47
(...skipping 10 matching lines...) Expand all
58 bool session_rate_ok; 58 bool session_rate_ok;
59 59
60 // Whether the availability model was ready. 60 // Whether the availability model was ready.
61 bool availability_model_ready_ok; 61 bool availability_model_ready_ok;
62 62
63 // Whether the availability precondition was met. 63 // Whether the availability precondition was met.
64 bool availability_ok; 64 bool availability_ok;
65 65
66 // Returns true if this result object has no errors, i.e. no values that 66 // Returns true if this result object has no errors, i.e. no values that
67 // are false. 67 // are false.
68 bool NoErrors(); 68 bool NoErrors() const;
69 }; 69 };
70 70
71 virtual ~ConditionValidator() = default; 71 virtual ~ConditionValidator() = default;
72 72
73 // Returns a Result object that describes whether each condition has been met. 73 // Returns a Result object that describes whether each condition has been met.
74 virtual Result MeetsConditions(const base::Feature& feature, 74 virtual Result MeetsConditions(const base::Feature& feature,
75 const FeatureConfig& config, 75 const FeatureConfig& config,
76 const Model& model, 76 const Model& model,
77 const AvailabilityModel& availability_model, 77 const AvailabilityModel& availability_model,
78 uint32_t current_day) const = 0; 78 uint32_t current_day) const = 0;
79 79
80 // Must be called to notify that the |feature| is currently showing. 80 // Must be called to notify that the |feature| is currently showing.
81 virtual void NotifyIsShowing(const base::Feature& feature) = 0; 81 virtual void NotifyIsShowing(const base::Feature& feature) = 0;
82 82
83 // Must be called to notify that the |feature| is no longer showing. 83 // Must be called to notify that the |feature| is no longer showing.
84 virtual void NotifyDismissed(const base::Feature& feature) = 0; 84 virtual void NotifyDismissed(const base::Feature& feature) = 0;
85 85
86 protected: 86 protected:
87 ConditionValidator() = default; 87 ConditionValidator() = default;
88 88
89 private: 89 private:
90 DISALLOW_COPY_AND_ASSIGN(ConditionValidator); 90 DISALLOW_COPY_AND_ASSIGN(ConditionValidator);
91 }; 91 };
92 92
93 } // namespace feature_engagement_tracker 93 } // namespace feature_engagement_tracker
94 94
95 #endif // COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_CONDITION_VALIDATOR_H_ 95 #endif // COMPONENTS_FEATURE_ENGAGEMENT_TRACKER_INTERNAL_CONDITION_VALIDATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698