Chromium Code Reviews| Index: chrome/browser/metrics/variations/eula_accepted_notifier.h |
| =================================================================== |
| --- chrome/browser/metrics/variations/eula_accepted_notifier.h (revision 203196) |
| +++ 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,10 @@ |
| virtual void OnEulaAccepted() = 0; |
| }; |
| - EulaAcceptedNotifier(); |
| + // Factory method for this class. |
| + static EulaAcceptedNotifier* Create(); |
|
SteveT
2013/05/31 12:20:08
I don't recall: Do we usually stick these factory
Alexei Svitkine (slow)
2013/05/31 15:25:17
Done.
|
| + |
| + explicit EulaAcceptedNotifier(PrefService* local_state); |
| virtual ~EulaAcceptedNotifier(); |
| // Initializes this class with the given |observer|. Must be called before |
| @@ -28,17 +33,23 @@ |
| // 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_; |