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 COMPONENTS_WEB_RESOURCE_EULA_ACCEPTED_NOTIFIER_H_
6 #define COMPONENTS_WEB_RESOURCE_EULA_ACCEPTED_NOTIFIER_H_
8 #include "base/basictypes.h"
9 #include "base/prefs/pref_change_registrar.h"
13 namespace web_resource
{
15 // Helper class for querying the EULA accepted state and receiving a
16 // notification when the EULA is accepted.
17 class EulaAcceptedNotifier
{
19 // Observes EULA accepted state changes.
22 virtual void OnEulaAccepted() = 0;
25 explicit EulaAcceptedNotifier(PrefService
* local_state
);
26 virtual ~EulaAcceptedNotifier();
28 // Initializes this class with the given |observer|. Must be called before
30 void Init(Observer
* observer
);
32 // Returns true if the EULA has been accepted. If the EULA has not yet been
33 // accepted, begins monitoring the EULA state and will notify the observer
34 // once the EULA has been accepted.
35 virtual bool IsEulaAccepted();
37 // Factory method for this class.
38 static EulaAcceptedNotifier
* Create(PrefService
* local_state
);
41 // Notifies the observer that the EULA has been updated, made protected for
43 void NotifyObserver();
46 // Callback for EULA accepted pref change notification.
49 // Local state pref service for querying the EULA accepted pref.
50 PrefService
* local_state_
;
52 // Used to listen for the EULA accepted pref change notification.
53 PrefChangeRegistrar registrar_
;
55 // Observer of the EULA accepted notification.
58 DISALLOW_COPY_AND_ASSIGN(EulaAcceptedNotifier
);
61 } // namespace web_resource
63 #endif // COMPONENTS_WEB_RESOURCE_EULA_ACCEPTED_NOTIFIER_H_