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

Unified Diff: ios/chrome/browser/prefs/pref_observer_bridge.mm

Issue 1090413007: [iOS] Upstream observer bridges (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 5 years, 8 months 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
« no previous file with comments | « ios/chrome/browser/prefs/pref_observer_bridge.h ('k') | ios/chrome/browser/sync/sync_observer_bridge.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/prefs/pref_observer_bridge.mm
diff --git a/ios/chrome/browser/prefs/pref_observer_bridge.mm b/ios/chrome/browser/prefs/pref_observer_bridge.mm
new file mode 100644
index 0000000000000000000000000000000000000000..ebd82f78e7d39b692b4bf86ec25c7157724c7028
--- /dev/null
+++ b/ios/chrome/browser/prefs/pref_observer_bridge.mm
@@ -0,0 +1,27 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/prefs/pref_observer_bridge.h"
+
+#include "base/bind.h"
+#include "base/prefs/pref_change_registrar.h"
+
+PrefObserverBridge::PrefObserverBridge(id<PrefObserverDelegate> delegate)
+ : delegate_(delegate) {
+}
+
+PrefObserverBridge::~PrefObserverBridge() {
+}
+
+void PrefObserverBridge::ObserveChangesForPreference(
+ const std::string& pref_name,
+ PrefChangeRegistrar* registrar) {
+ PrefChangeRegistrar::NamedChangeCallback callback = base::Bind(
+ &PrefObserverBridge::OnPreferenceChanged, base::Unretained(this));
+ registrar->Add(pref_name.c_str(), callback);
+}
+
+void PrefObserverBridge::OnPreferenceChanged(const std::string& pref_name) {
+ [delegate_ onPreferenceChanged:pref_name];
+}
« no previous file with comments | « ios/chrome/browser/prefs/pref_observer_bridge.h ('k') | ios/chrome/browser/sync/sync_observer_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698