Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome/browser/policy/managed_prefs_banner_base.h

Issue 7342009: Show a different banner in chrome://settings for extension-controlled settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/policy/managed_prefs_banner_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 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_POLICY_MANAGED_PREFS_BANNER_BASE_H_
6 #define CHROME_BROWSER_POLICY_MANAGED_PREFS_BANNER_BASE_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/ui/options/options_util.h"
12 #include "content/common/notification_observer.h"
13
14 class PrefService;
15 class PrefSetObserver;
16
17 namespace policy {
18
19 // Common base functionality for the managed prefs warning banner displayed in
20 // the preference dialogs when there are options that are controlled by
21 // configuration policy and thus cannot be changed by the user.
22 class ManagedPrefsBannerBase : public NotificationObserver {
23 public:
24 // Initialize the banner with a set of preferences suitable for the given
25 // options |page|. Subclasses may change that set by calling AddPref() and
26 // RemovePref() afterwards.
27 ManagedPrefsBannerBase(PrefService* local_state,
28 PrefService* user_prefs,
29 OptionsPage page);
30
31 // Convenience constructor that fetches the local state PrefService from the
32 // global g_browser_process.
33 ManagedPrefsBannerBase(PrefService* user_prefs, OptionsPage page);
34
35 virtual ~ManagedPrefsBannerBase();
36
37 // Determine whether the banner should be visible.
38 bool DetermineVisibility() const;
39
40 // Add a local state preference as visibility trigger.
41 void AddLocalStatePref(const char* pref);
42 // Remove a local state preference from being a visibility trigger.
43 void RemoveLocalStatePref(const char* pref);
44
45 // Add a user preference as visibility trigger.
46 void AddUserPref(const char* pref);
47 // Remove a user preference from being a visibility trigger.
48 void RemoveUserPref(const char* pref);
49
50 protected:
51 // Update banner visibility. This is called whenever a preference change is
52 // observed that may lead to changed visibility of the banner. Subclasses may
53 // override this in order to show/hide the banner.
54 virtual void OnUpdateVisibility() { }
55
56 private:
57 // Initialization helper, called from the constructors.
58 void Init(PrefService* local_state,
59 PrefService* user_prefs,
60 OptionsPage page);
61
62 // |NotificationObserver| implementation.
63 virtual void Observe(int type,
64 const NotificationSource& source,
65 const NotificationDetails& details);
66
67 scoped_ptr<PrefSetObserver> local_state_set_;
68 scoped_ptr<PrefSetObserver> user_pref_set_;
69
70 DISALLOW_COPY_AND_ASSIGN(ManagedPrefsBannerBase);
71 };
72
73 } // namespace policy
74
75 #endif // CHROME_BROWSER_POLICY_MANAGED_PREFS_BANNER_BASE_H_
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/policy/managed_prefs_banner_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698