1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_WEB_RESOURCE_EULA_ACCEPTED_NOTIFIER_H_
6 #define CHROME_BROWSER_WEB_RESOURCE_EULA_ACCEPTED_NOTIFIER_H_
8 #include "base/basictypes.h"
9 #include "base/prefs/pref_change_registrar.h"
13 // Helper class for querying the EULA accepted state and receiving a
14 // notification when the EULA is accepted.
15 class EulaAcceptedNotifier
{
17 // Observes EULA accepted state changes.
20 virtual void OnEulaAccepted() = 0;
23 explicit EulaAcceptedNotifier(PrefService
* local_state
);
24 virtual ~EulaAcceptedNotifier();
26 // Initializes this class with the given |observer|. Must be called before
28 void Init(Observer
* observer
);
30 // Returns true if the EULA has been accepted. If the EULA has not yet been
31 // accepted, begins monitoring the EULA state and will notify the observer
32 // once the EULA has been accepted.
33 virtual bool IsEulaAccepted();
35 // Factory method for this class.
36 static EulaAcceptedNotifier
* Create();
39 // Notifies the observer that the EULA has been updated, made protected for
41 void NotifyObserver();
44 // Callback for EULA accepted pref change notification.
47 // Local state pref service for querying the EULA accepted pref.
48 PrefService
* local_state_
;
50 // Used to listen for the EULA accepted pref change notification.
51 PrefChangeRegistrar registrar_
;
53 // Observer of the EULA accepted notification.
56 DISALLOW_COPY_AND_ASSIGN(EulaAcceptedNotifier
);
59 #endif // CHROME_BROWSER_WEB_RESOURCE_EULA_ACCEPTED_NOTIFIER_H_