| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__ | 5 #ifndef CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__ |
| 6 #define CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__ | 6 #define CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__ |
| 7 | 7 |
| 8 #include "chrome/browser/options_window.h" | 8 #include "chrome/browser/options_page_base.h" |
| 9 #include "chrome/browser/profile.h" | |
| 10 #include "chrome/common/notification_observer.h" | |
| 11 #include "views/controls/link.h" | 9 #include "views/controls/link.h" |
| 12 #include "views/controls/button/native_button.h" | 10 #include "views/controls/button/native_button.h" |
| 13 | 11 |
| 14 class PrefService; | 12 class PrefService; |
| 15 | 13 |
| 16 /////////////////////////////////////////////////////////////////////////////// | 14 /////////////////////////////////////////////////////////////////////////////// |
| 17 // OptionsPageView | 15 // OptionsPageView |
| 18 // | 16 // |
| 19 // A base class for Options dialog pages that handles ensuring control | 17 // A base class for Options dialog pages that handles ensuring control |
| 20 // initialization is done just once. | 18 // initialization is done just once. |
| 21 // | 19 // |
| 22 class OptionsPageView : public views::View, | 20 class OptionsPageView : public views::View, |
| 23 public NotificationObserver { | 21 public OptionsPageBase { |
| 24 public: | 22 public: |
| 25 virtual ~OptionsPageView(); | 23 virtual ~OptionsPageView(); |
| 26 | 24 |
| 27 // Returns true if the window containing this view can be closed, given the | 25 // Returns true if the window containing this view can be closed, given the |
| 28 // current state of this view. This can be used to prevent the window from | 26 // current state of this view. This can be used to prevent the window from |
| 29 // being closed when a modal dialog box is showing, for example. | 27 // being closed when a modal dialog box is showing, for example. |
| 30 virtual bool CanClose() const { return true; } | 28 virtual bool CanClose() const { return true; } |
| 31 | 29 |
| 32 // Highlights the specified group to attract the user's attention. | |
| 33 virtual void HighlightGroup(OptionsGroup highlight_group) { } | |
| 34 | |
| 35 // Overridden from NotificationObserver: | |
| 36 virtual void Observe(NotificationType type, | |
| 37 const NotificationSource& source, | |
| 38 const NotificationDetails& details); | |
| 39 | |
| 40 protected: | 30 protected: |
| 41 // This class cannot be instantiated directly, but its constructor must be | 31 // This class cannot be instantiated directly, but its constructor must be |
| 42 // called by derived classes. | 32 // called by derived classes. |
| 43 explicit OptionsPageView(Profile* profile); | 33 explicit OptionsPageView(Profile* profile); |
| 44 | 34 |
| 45 // Returns the Profile associated with this page. | |
| 46 Profile* profile() const { return profile_; } | |
| 47 | |
| 48 // Records a user action and schedules the prefs file to be saved. | |
| 49 void UserMetricsRecordAction(const wchar_t* action, PrefService* prefs); | |
| 50 | |
| 51 // Initializes the layout of the controls within the panel. | 35 // Initializes the layout of the controls within the panel. |
| 52 virtual void InitControlLayout() = 0; | 36 virtual void InitControlLayout() = 0; |
| 53 | 37 |
| 54 // Allows the UI to update when a preference value changes. The parameter is | |
| 55 // the specific pref that changed, or NULL if all pref UI should be | |
| 56 // validated. This is also called immediately after InitControlLayout() | |
| 57 // during setup, but with NULL as the parameter to allow initial state to be | |
| 58 // set. | |
| 59 virtual void NotifyPrefChanged(const std::wstring* pref_name) { } | |
| 60 | |
| 61 // views::View overrides: | 38 // views::View overrides: |
| 62 virtual void ViewHierarchyChanged(bool is_add, | 39 virtual void ViewHierarchyChanged(bool is_add, |
| 63 views::View* parent, | 40 views::View* parent, |
| 64 views::View* child); | 41 views::View* child); |
| 65 | 42 |
| 66 private: | 43 private: |
| 67 // The Profile associated with this page. | |
| 68 Profile* profile_; | |
| 69 | |
| 70 // Whether or not the control layout has been initialized for this page. | 44 // Whether or not the control layout has been initialized for this page. |
| 71 bool initialized_; | 45 bool initialized_; |
| 72 | 46 |
| 73 DISALLOW_EVIL_CONSTRUCTORS(OptionsPageView); | 47 DISALLOW_EVIL_CONSTRUCTORS(OptionsPageView); |
| 74 }; | 48 }; |
| 75 | 49 |
| 76 #endif // #ifndef CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__ | 50 #endif // #ifndef CHROME_BROWSER_VIEWS_OPTIONS_OPTIONS_PAGE_VIEW_H__ |
| OLD | NEW |