OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2009 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_OPTIONS_PAGE_BASE_H_ |
| 6 #define CHROME_BROWSER_OPTIONS_PAGE_BASE_H_ |
| 7 |
| 8 #include "chrome/browser/options_window.h" |
| 9 #include "chrome/browser/profile.h" |
| 10 #include "chrome/common/notification_observer.h" |
| 11 |
| 12 class PrefService; |
| 13 |
| 14 /////////////////////////////////////////////////////////////////////////////// |
| 15 // OptionsPageBase |
| 16 // |
| 17 // A base class for Options dialog pages that handles observing preferences |
| 18 // |
| 19 class OptionsPageBase : public NotificationObserver { |
| 20 public: |
| 21 virtual ~OptionsPageBase(); |
| 22 |
| 23 // Highlights the specified group to attract the user's attention. |
| 24 virtual void HighlightGroup(OptionsGroup highlight_group) { } |
| 25 |
| 26 // Overridden from NotificationObserver: |
| 27 virtual void Observe(NotificationType type, |
| 28 const NotificationSource& source, |
| 29 const NotificationDetails& details); |
| 30 |
| 31 protected: |
| 32 // This class cannot be instantiated directly, but its constructor must be |
| 33 // called by derived classes. |
| 34 explicit OptionsPageBase(Profile* profile); |
| 35 |
| 36 // Returns the Profile associated with this page. |
| 37 Profile* profile() const { return profile_; } |
| 38 |
| 39 // Records a user action and schedules the prefs file to be saved. |
| 40 void UserMetricsRecordAction(const wchar_t* action, PrefService* prefs); |
| 41 |
| 42 // Allows the UI to update when a preference value changes. The parameter is |
| 43 // the specific pref that changed, or NULL if all pref UI should be |
| 44 // validated. This should be called during setup, but with NULL as the |
| 45 // parameter to allow initial state to be set. |
| 46 virtual void NotifyPrefChanged(const std::wstring* pref_name) { } |
| 47 |
| 48 private: |
| 49 // The Profile associated with this page. |
| 50 Profile* profile_; |
| 51 |
| 52 DISALLOW_EVIL_CONSTRUCTORS(OptionsPageBase); |
| 53 }; |
| 54 |
| 55 #endif // CHROME_BROWSER_OPTIONS_PAGE_BASE_H_ |
OLD | NEW |