OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_POLICY_MANAGED_PREFS_BANNER_BASE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_MANAGED_PREFS_BANNER_BASE_H_ |
6 #define CHROME_BROWSER_POLICY_MANAGED_PREFS_BANNER_BASE_H_ | 6 #define CHROME_BROWSER_POLICY_MANAGED_PREFS_BANNER_BASE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
11 #include "chrome/browser/options_window.h" | 11 #include "chrome/browser/options_window.h" |
12 #include "chrome/browser/prefs/pref_set_observer.h" | |
13 #include "chrome/common/notification_observer.h" | 12 #include "chrome/common/notification_observer.h" |
14 | 13 |
15 class PrefService; | 14 class PrefService; |
| 15 class PrefSetObserver; |
16 | 16 |
17 namespace policy { | 17 namespace policy { |
18 | 18 |
19 // Common base functionality for the managed prefs warning banner displayed in | 19 // Common base functionality for the managed prefs warning banner displayed in |
20 // the preference dialogs when there are options that are controlled by | 20 // the preference dialogs when there are options that are controlled by |
21 // configuration policy and thus cannot be changed by the user. | 21 // configuration policy and thus cannot be changed by the user. |
22 class ManagedPrefsBannerBase : public NotificationObserver { | 22 class ManagedPrefsBannerBase : public NotificationObserver { |
23 public: | 23 public: |
24 // Initialize the banner with a set of preferences suitable for the given | 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 | 25 // options |page|. Subclasses may change that set by calling AddPref() and |
26 // RemovePref() afterwards. | 26 // RemovePref() afterwards. |
27 ManagedPrefsBannerBase(PrefService* local_state, | 27 ManagedPrefsBannerBase(PrefService* local_state, |
28 PrefService* user_prefs, | 28 PrefService* user_prefs, |
29 OptionsPage page); | 29 OptionsPage page); |
30 | 30 |
31 // Convenience constructor that fetches the local state PrefService from the | 31 // Convenience constructor that fetches the local state PrefService from the |
32 // global g_browser_process. | 32 // global g_browser_process. |
33 ManagedPrefsBannerBase(PrefService* user_prefs, OptionsPage page); | 33 ManagedPrefsBannerBase(PrefService* user_prefs, OptionsPage page); |
34 | 34 |
| 35 virtual ~ManagedPrefsBannerBase(); |
| 36 |
35 // Determine whether the banner should be visible. | 37 // Determine whether the banner should be visible. |
36 bool DetermineVisibility() const; | 38 bool DetermineVisibility() const; |
37 | 39 |
38 // Add a local state preference as visibility trigger. | 40 // Add a local state preference as visibility trigger. |
39 void AddLocalStatePref(const char* pref); | 41 void AddLocalStatePref(const char* pref); |
40 // Remove a local state preference from being a visibility trigger. | 42 // Remove a local state preference from being a visibility trigger. |
41 void RemoveLocalStatePref(const char* pref); | 43 void RemoveLocalStatePref(const char* pref); |
42 | 44 |
43 // Add a user preference as visibility trigger. | 45 // Add a user preference as visibility trigger. |
44 void AddUserPref(const char* pref); | 46 void AddUserPref(const char* pref); |
(...skipping 19 matching lines...) Expand all Loading... |
64 | 66 |
65 scoped_ptr<PrefSetObserver> local_state_set_; | 67 scoped_ptr<PrefSetObserver> local_state_set_; |
66 scoped_ptr<PrefSetObserver> user_pref_set_; | 68 scoped_ptr<PrefSetObserver> user_pref_set_; |
67 | 69 |
68 DISALLOW_COPY_AND_ASSIGN(ManagedPrefsBannerBase); | 70 DISALLOW_COPY_AND_ASSIGN(ManagedPrefsBannerBase); |
69 }; | 71 }; |
70 | 72 |
71 } // namespace policy | 73 } // namespace policy |
72 | 74 |
73 #endif // CHROME_BROWSER_POLICY_MANAGED_PREFS_BANNER_BASE_H_ | 75 #endif // CHROME_BROWSER_POLICY_MANAGED_PREFS_BANNER_BASE_H_ |
OLD | NEW |