From 1703157a0410dbd23b8968aa8e6ce9e4adc45def Mon Sep 17 00:00:00 2001 From: "mnissler@chromium.org" Date: Tue, 8 Jun 2010 09:55:47 +0000 Subject: Managed preferences warning banner for the Linux preferences dialog. BUG=43423 TEST=Unit test in managed_prefs_banner_base_unittest.cc, manual UI tests Review URL: http://codereview.chromium.org/2425006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49151 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/managed_prefs_banner_base.h | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 chrome/browser/managed_prefs_banner_base.h (limited to 'chrome/browser/managed_prefs_banner_base.h') diff --git a/chrome/browser/managed_prefs_banner_base.h b/chrome/browser/managed_prefs_banner_base.h new file mode 100644 index 0000000..f0013ca --- /dev/null +++ b/chrome/browser/managed_prefs_banner_base.h @@ -0,0 +1,47 @@ +// Copyright (c) 2010 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_MANAGED_PREFS_BANNER_BASE_H_ +#define CHROME_BROWSER_MANAGED_PREFS_BANNER_BASE_H_ + +#include +#include + +#include "base/basictypes.h" +#include "chrome/common/notification_observer.h" + +class PrefService; + +// Common base functionality for the managed prefs warning banner displayed in +// the preference dialogs when there are options that are controlled by +// configuration policy and thus cannot be changed by the user. +class ManagedPrefsBannerBase : public NotificationObserver { + public: + ManagedPrefsBannerBase(PrefService* prefs, + const wchar_t** relevant_prefs, + size_t count); + virtual ~ManagedPrefsBannerBase(); + + // Determine whether the banner should be visible. + bool DetermineVisibility() const; + + // |NotificationObserver| implementation. + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + + protected: + // Update banner visibility. This is called whenever a preference change is + // observed that may lead to changed visibility of the banner. Subclasses may + // override this in order to show/hide the banner. + virtual void OnUpdateVisibility() { } + + private: + PrefService* prefs_; + typedef std::set PrefSet; + const PrefSet relevant_prefs_; + + DISALLOW_COPY_AND_ASSIGN(ManagedPrefsBannerBase); +}; +#endif // CHROME_BROWSER_MANAGED_PREFS_BANNER_BASE_H_ -- cgit v1.1