OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_EULA_ACCEPTED_NOTIFIER_H_ |
| 6 #define CHROME_BROWSER_METRICS_VARIATIONS_EULA_ACCEPTED_NOTIFIER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 |
| 10 // Interface for querying the EULA accepted state and receiving a notification |
| 11 // when the EULA is accepted. This abstracts away the platform-specific logic |
| 12 // for EULA notifications on different platforms. |
| 13 class EulaAcceptedNotifier { |
| 14 public: |
| 15 // Observes EULA accepted state changes. |
| 16 class Observer { |
| 17 public: |
| 18 virtual void OnEulaAccepted() = 0; |
| 19 }; |
| 20 |
| 21 EulaAcceptedNotifier(); |
| 22 virtual ~EulaAcceptedNotifier(); |
| 23 |
| 24 // Initializes this class with the given |observer|. Must be called before |
| 25 // the class is used. |
| 26 void Init(Observer* observer); |
| 27 |
| 28 // Returns true if the EULA has been accepted. If the EULA has not yet been |
| 29 // accepted, begins monitoring the EULA state and will notify the observer |
| 30 // once the EULA has been accepted. |
| 31 virtual bool IsEulaAccepted() = 0; |
| 32 |
| 33 // Factory method for this class. |
| 34 static EulaAcceptedNotifier* Create(); |
| 35 |
| 36 protected: |
| 37 // Notifies the observer that the EULA has been updated, to be called by |
| 38 // platform-specific subclasses. |
| 39 void NotifyObserver(); |
| 40 |
| 41 private: |
| 42 // Observer of the EULA accepted notification. |
| 43 Observer* observer_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(EulaAcceptedNotifier); |
| 46 }; |
| 47 |
| 48 #endif // CHROME_BROWSER_METRICS_VARIATIONS_EULA_ACCEPTED_NOTIFIER_H_ |
OLD | NEW |