| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/browser/prefs/pref_set_observer.h" |
| 10 #include "chrome/common/chrome_notification_types.h" |
| 10 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
| 11 #include "content/common/notification_details.h" | 12 #include "content/common/notification_details.h" |
| 12 #include "content/common/notification_type.h" | |
| 13 | 13 |
| 14 namespace policy { | 14 namespace policy { |
| 15 | 15 |
| 16 ManagedPrefsBannerBase::ManagedPrefsBannerBase(PrefService* user_prefs, | 16 ManagedPrefsBannerBase::ManagedPrefsBannerBase(PrefService* user_prefs, |
| 17 OptionsPage page) { | 17 OptionsPage page) { |
| 18 Init(g_browser_process->local_state(), user_prefs, page); | 18 Init(g_browser_process->local_state(), user_prefs, page); |
| 19 } | 19 } |
| 20 | 20 |
| 21 ManagedPrefsBannerBase::ManagedPrefsBannerBase(PrefService* local_state, | 21 ManagedPrefsBannerBase::ManagedPrefsBannerBase(PrefService* local_state, |
| 22 PrefService* user_prefs, | 22 PrefService* user_prefs, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 AddUserPref(prefs::kCloudPrintProxyEnabled); | 91 AddUserPref(prefs::kCloudPrintProxyEnabled); |
| 92 AddUserPref(prefs::kDownloadDefaultDirectory); | 92 AddUserPref(prefs::kDownloadDefaultDirectory); |
| 93 AddUserPref(prefs::kPromptForDownload); | 93 AddUserPref(prefs::kPromptForDownload); |
| 94 AddUserPref(prefs::kEnableTranslate); | 94 AddUserPref(prefs::kEnableTranslate); |
| 95 break; | 95 break; |
| 96 default: | 96 default: |
| 97 NOTREACHED(); | 97 NOTREACHED(); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 void ManagedPrefsBannerBase::Observe(NotificationType type, | 101 void ManagedPrefsBannerBase::Observe(int type, |
| 102 const NotificationSource& source, | 102 const NotificationSource& source, |
| 103 const NotificationDetails& details) { | 103 const NotificationDetails& details) { |
| 104 if (NotificationType::PREF_CHANGED == type) { | 104 if (chrome::NOTIFICATION_PREF_CHANGED == type) { |
| 105 std::string* pref = Details<std::string>(details).ptr(); | 105 std::string* pref = Details<std::string>(details).ptr(); |
| 106 if (pref && (local_state_set_->IsObserved(*pref) || | 106 if (pref && (local_state_set_->IsObserved(*pref) || |
| 107 user_pref_set_->IsObserved(*pref))) | 107 user_pref_set_->IsObserved(*pref))) |
| 108 OnUpdateVisibility(); | 108 OnUpdateVisibility(); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace policy | 112 } // namespace policy |
| OLD | NEW |