Index: chrome/browser/metrics/variations/eula_accepted_notifier.h |
=================================================================== |
--- chrome/browser/metrics/variations/eula_accepted_notifier.h (revision 203226) |
+++ chrome/browser/metrics/variations/eula_accepted_notifier.h (working copy) |
@@ -6,10 +6,12 @@ |
#define CHROME_BROWSER_METRICS_VARIATIONS_EULA_ACCEPTED_NOTIFIER_H_ |
#include "base/basictypes.h" |
+#include "base/prefs/pref_change_registrar.h" |
-// Interface for querying the EULA accepted state and receiving a notification |
-// when the EULA is accepted. This abstracts away the platform-specific logic |
-// for EULA notifications on different platforms. |
+class PrefService; |
+ |
+// Helper class for querying the EULA accepted state and receiving a |
+// notification when the EULA is accepted. |
class EulaAcceptedNotifier { |
public: |
// Observes EULA accepted state changes. |
@@ -18,7 +20,7 @@ |
virtual void OnEulaAccepted() = 0; |
}; |
- EulaAcceptedNotifier(); |
+ explicit EulaAcceptedNotifier(PrefService* local_state); |
virtual ~EulaAcceptedNotifier(); |
// Initializes this class with the given |observer|. Must be called before |
@@ -28,17 +30,26 @@ |
// Returns true if the EULA has been accepted. If the EULA has not yet been |
// accepted, begins monitoring the EULA state and will notify the observer |
// once the EULA has been accepted. |
- virtual bool IsEulaAccepted() = 0; |
+ virtual bool IsEulaAccepted(); |
// Factory method for this class. |
static EulaAcceptedNotifier* Create(); |
protected: |
- // Notifies the observer that the EULA has been updated, to be called by |
- // platform-specific subclasses. |
+ // Notifies the observer that the EULA has been updated, made protected for |
+ // testing. |
void NotifyObserver(); |
private: |
+ // Callback for EULA accepted pref change notification. |
+ void OnPrefChanged(); |
+ |
+ // Local state pref service for querying the EULA accepted pref. |
+ PrefService* local_state_; |
+ |
+ // Used to listen for the EULA accepted pref change notification. |
+ PrefChangeRegistrar registrar_; |
+ |
// Observer of the EULA accepted notification. |
Observer* observer_; |