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

Unified Diff: chrome/browser/chromeos/system/ash_system_tray_delegate.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/system/ash_system_tray_delegate.cc
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index a62883e88a93d72173eda4d9e49ce4bf0bc9b24c..cc6930c476388b6433ed6e60b8f5c07715a6e881 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -26,6 +26,7 @@
#include "base/chromeos/chromeos_version.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
+#include "base/prefs/public/pref_observer.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/accessibility/accessibility_util.h"
@@ -151,6 +152,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
public NetworkLibrary::NetworkManagerObserver,
public NetworkLibrary::NetworkObserver,
public NetworkLibrary::CellularDataPlanObserver,
+ public PrefObserver,
public google_apis::DriveServiceObserver,
public content::NotificationObserver,
public input_method::InputMethodManager::Observer,
@@ -1088,26 +1090,6 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
ObserveGDataUpdates();
break;
}
- case chrome::NOTIFICATION_PREF_CHANGED: {
- std::string pref = *content::Details<std::string>(details).ptr();
- PrefService* service = content::Source<PrefService>(source).ptr();
- if (pref == prefs::kUse24HourClock) {
- UpdateClockType(service);
- } else if (pref == prefs::kLanguageRemapSearchKeyTo) {
- search_key_mapped_to_ =
- service->GetInteger(prefs::kLanguageRemapSearchKeyTo);
- } else if (pref == prefs::kSpokenFeedbackEnabled) {
- ash::AccessibilityObserver* observer =
- tray_->accessibility_observer();
- if (observer) {
- observer->OnAccessibilityModeChanged(
- service->GetBoolean(prefs::kSpokenFeedbackEnabled));
- }
- } else {
- NOTREACHED();
- }
- break;
- }
case chrome::NOTIFICATION_PROFILE_CREATED: {
SetProfile(content::Source<Profile>(source).ptr());
registrar_.Remove(this,
@@ -1126,6 +1108,25 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
}
}
+ virtual void OnPreferenceChanged(PrefServiceBase* service,
+ const std::string& pref) OVERRIDE {
+ if (pref == prefs::kUse24HourClock) {
+ UpdateClockType(static_cast<PrefService*>(service));
+ } else if (pref == prefs::kLanguageRemapSearchKeyTo) {
+ search_key_mapped_to_ =
+ service->GetInteger(prefs::kLanguageRemapSearchKeyTo);
+ } else if (pref == prefs::kSpokenFeedbackEnabled) {
+ ash::AccessibilityObserver* observer =
+ tray_->accessibility_observer();
+ if (observer) {
+ observer->OnAccessibilityModeChanged(
+ service->GetBoolean(prefs::kSpokenFeedbackEnabled));
+ }
+ } else {
+ NOTREACHED();
+ }
+ }
+
// Overridden from InputMethodManager::Observer.
virtual void InputMethodChanged(
input_method::InputMethodManager* manager, bool show_message) OVERRIDE {

Powered by Google App Engine
This is Rietveld 408576698