OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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 #import "ios/chrome/browser/prefs/pref_observer_bridge.h" | 5 #import "ios/chrome/browser/prefs/pref_observer_bridge.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/prefs/pref_change_registrar.h" | 8 #include "components/prefs/pref_change_registrar.h" |
9 | 9 |
10 PrefObserverBridge::PrefObserverBridge(id<PrefObserverDelegate> delegate) | 10 PrefObserverBridge::PrefObserverBridge(id<PrefObserverDelegate> delegate) |
11 : delegate_(delegate) { | 11 : delegate_(delegate) { |
12 } | 12 } |
13 | 13 |
14 PrefObserverBridge::~PrefObserverBridge() { | 14 PrefObserverBridge::~PrefObserverBridge() { |
15 } | 15 } |
16 | 16 |
17 void PrefObserverBridge::ObserveChangesForPreference( | 17 void PrefObserverBridge::ObserveChangesForPreference( |
18 const std::string& pref_name, | 18 const std::string& pref_name, |
19 PrefChangeRegistrar* registrar) { | 19 PrefChangeRegistrar* registrar) { |
20 PrefChangeRegistrar::NamedChangeCallback callback = base::Bind( | 20 PrefChangeRegistrar::NamedChangeCallback callback = base::Bind( |
21 &PrefObserverBridge::OnPreferenceChanged, base::Unretained(this)); | 21 &PrefObserverBridge::OnPreferenceChanged, base::Unretained(this)); |
22 registrar->Add(pref_name.c_str(), callback); | 22 registrar->Add(pref_name.c_str(), callback); |
23 } | 23 } |
24 | 24 |
25 void PrefObserverBridge::OnPreferenceChanged(const std::string& pref_name) { | 25 void PrefObserverBridge::OnPreferenceChanged(const std::string& pref_name) { |
26 [delegate_ onPreferenceChanged:pref_name]; | 26 [delegate_ onPreferenceChanged:pref_name]; |
27 } | 27 } |
OLD | NEW |