summaryrefslogtreecommitdiffstats
path: root/chrome/browser/options_page_base.h
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 21:23:18 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-28 21:23:18 +0000
commit31caf9184f97fc3a45eeac0d7fe869e261997e65 (patch)
treeac08dfc73e4ff037488c14107c17091d379fbfee /chrome/browser/options_page_base.h
parentad05af6e6f231a8e4283e13c8f7652454c223cc1 (diff)
downloadchromium_src-31caf9184f97fc3a45eeac0d7fe869e261997e65.zip
chromium_src-31caf9184f97fc3a45eeac0d7fe869e261997e65.tar.gz
chromium_src-31caf9184f97fc3a45eeac0d7fe869e261997e65.tar.bz2
Add general options page. Options are working with the following exceptions:
Custom start urls and default search options widgets aren't hooked up. Home page settings work, but are overridden by the linux start page settings. Default browser checking/setting functions are not implemented, so the option isn't useful yet. Refactors some common code out of browser/views/options/options_page_view.* into browser/options_page_base.{cc,h} BUG=11507 Patch by Matt Mueller (mattm@google.com). Review URL: http://codereview.chromium.org/113967 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/options_page_base.h')
-rw-r--r--chrome/browser/options_page_base.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/chrome/browser/options_page_base.h b/chrome/browser/options_page_base.h
new file mode 100644
index 0000000..dd79767
--- /dev/null
+++ b/chrome/browser/options_page_base.h
@@ -0,0 +1,55 @@
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_OPTIONS_PAGE_BASE_H_
+#define CHROME_BROWSER_OPTIONS_PAGE_BASE_H_
+
+#include "chrome/browser/options_window.h"
+#include "chrome/browser/profile.h"
+#include "chrome/common/notification_observer.h"
+
+class PrefService;
+
+///////////////////////////////////////////////////////////////////////////////
+// OptionsPageBase
+//
+// A base class for Options dialog pages that handles observing preferences
+//
+class OptionsPageBase : public NotificationObserver {
+ public:
+ virtual ~OptionsPageBase();
+
+ // Highlights the specified group to attract the user's attention.
+ virtual void HighlightGroup(OptionsGroup highlight_group) { }
+
+ // Overridden from NotificationObserver:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ protected:
+ // This class cannot be instantiated directly, but its constructor must be
+ // called by derived classes.
+ explicit OptionsPageBase(Profile* profile);
+
+ // Returns the Profile associated with this page.
+ Profile* profile() const { return profile_; }
+
+ // Records a user action and schedules the prefs file to be saved.
+ void UserMetricsRecordAction(const wchar_t* action, PrefService* prefs);
+
+ // Allows the UI to update when a preference value changes. The parameter is
+ // the specific pref that changed, or NULL if all pref UI should be
+ // validated. This should be called during setup, but with NULL as the
+ // parameter to allow initial state to be set.
+ virtual void NotifyPrefChanged(const std::wstring* pref_name) { }
+
+ private:
+ // The Profile associated with this page.
+ Profile* profile_;
+
+ DISALLOW_EVIL_CONSTRUCTORS(OptionsPageBase);
+};
+
+#endif // CHROME_BROWSER_OPTIONS_PAGE_BASE_H_