1 // Copyright 2012 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.
5 #import "ios/chrome/browser/prefs/pref_observer_bridge.h"
8 #include "base/prefs/pref_change_registrar.h"
10 PrefObserverBridge::PrefObserverBridge(id<PrefObserverDelegate> delegate)
11 : delegate_(delegate) {
14 PrefObserverBridge::~PrefObserverBridge() {
17 void PrefObserverBridge::ObserveChangesForPreference(
18 const std::string& pref_name,
19 PrefChangeRegistrar* registrar) {
20 PrefChangeRegistrar::NamedChangeCallback callback = base::Bind(
21 &PrefObserverBridge::OnPreferenceChanged, base::Unretained(this));
22 registrar->Add(pref_name.c_str(), callback);
25 void PrefObserverBridge::OnPreferenceChanged(const std::string& pref_name) {
26 [delegate_ onPreferenceChanged:pref_name];