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 #include "chrome/browser/policy/managed_prefs_banner_base.h" | 5 #include "chrome/browser/policy/managed_prefs_banner_base.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
| 9 #include "chrome/browser/prefs/pref_set_observer.h" |
9 #include "chrome/common/notification_details.h" | 10 #include "chrome/common/notification_details.h" |
10 #include "chrome/common/notification_type.h" | 11 #include "chrome/common/notification_type.h" |
11 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
12 | 13 |
13 namespace policy { | 14 namespace policy { |
14 | 15 |
15 ManagedPrefsBannerBase::ManagedPrefsBannerBase(PrefService* user_prefs, | 16 ManagedPrefsBannerBase::ManagedPrefsBannerBase(PrefService* user_prefs, |
16 OptionsPage page) { | 17 OptionsPage page) { |
17 Init(g_browser_process->local_state(), user_prefs, page); | 18 Init(g_browser_process->local_state(), user_prefs, page); |
18 } | 19 } |
19 | 20 |
20 ManagedPrefsBannerBase::ManagedPrefsBannerBase(PrefService* local_state, | 21 ManagedPrefsBannerBase::ManagedPrefsBannerBase(PrefService* local_state, |
21 PrefService* user_prefs, | 22 PrefService* user_prefs, |
22 OptionsPage page) { | 23 OptionsPage page) { |
23 Init(local_state, user_prefs, page); | 24 Init(local_state, user_prefs, page); |
24 } | 25 } |
25 | 26 |
| 27 ManagedPrefsBannerBase::~ManagedPrefsBannerBase() {} |
| 28 |
26 void ManagedPrefsBannerBase::AddLocalStatePref(const char* pref) { | 29 void ManagedPrefsBannerBase::AddLocalStatePref(const char* pref) { |
27 local_state_set_->AddPref(pref); | 30 local_state_set_->AddPref(pref); |
28 } | 31 } |
29 | 32 |
30 void ManagedPrefsBannerBase::RemoveLocalStatePref(const char* pref) { | 33 void ManagedPrefsBannerBase::RemoveLocalStatePref(const char* pref) { |
31 local_state_set_->RemovePref(pref); | 34 local_state_set_->RemovePref(pref); |
32 } | 35 } |
33 | 36 |
34 void ManagedPrefsBannerBase::AddUserPref(const char* pref) { | 37 void ManagedPrefsBannerBase::AddUserPref(const char* pref) { |
35 user_pref_set_->AddPref(pref); | 38 user_pref_set_->AddPref(pref); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 const NotificationDetails& details) { | 100 const NotificationDetails& details) { |
98 if (NotificationType::PREF_CHANGED == type) { | 101 if (NotificationType::PREF_CHANGED == type) { |
99 std::string* pref = Details<std::string>(details).ptr(); | 102 std::string* pref = Details<std::string>(details).ptr(); |
100 if (pref && (local_state_set_->IsObserved(*pref) || | 103 if (pref && (local_state_set_->IsObserved(*pref) || |
101 user_pref_set_->IsObserved(*pref))) | 104 user_pref_set_->IsObserved(*pref))) |
102 OnUpdateVisibility(); | 105 OnUpdateVisibility(); |
103 } | 106 } |
104 } | 107 } |
105 | 108 |
106 } // namespace policy | 109 } // namespace policy |
OLD | NEW |