OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/sync_preferences/synced_pref_change_registrar.h" | 5 #include "components/sync_preferences/synced_pref_change_registrar.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 | 8 |
9 namespace sync_preferences { | 9 namespace sync_preferences { |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 observers_.clear(); | 53 observers_.clear(); |
54 } | 54 } |
55 | 55 |
56 bool SyncedPrefChangeRegistrar::IsObserved(const char* path) const { | 56 bool SyncedPrefChangeRegistrar::IsObserved(const char* path) const { |
57 return observers_.find(path) != observers_.end(); | 57 return observers_.find(path) != observers_.end(); |
58 } | 58 } |
59 | 59 |
60 void SyncedPrefChangeRegistrar::OnSyncedPrefChanged(const std::string& path, | 60 void SyncedPrefChangeRegistrar::OnSyncedPrefChanged(const std::string& path, |
61 bool from_sync) { | 61 bool from_sync) { |
62 if (pref_service_->IsManagedPreference(path.c_str())) | 62 if (pref_service_->IsManagedPreference(path)) |
63 return; | 63 return; |
64 ObserverMap::const_iterator iter = observers_.find(path); | 64 ObserverMap::const_iterator iter = observers_.find(path); |
65 if (iter == observers_.end()) | 65 if (iter == observers_.end()) |
66 return; | 66 return; |
67 iter->second.Run(path, from_sync); | 67 iter->second.Run(path, from_sync); |
68 } | 68 } |
69 | 69 |
70 } // namespace sync_preferences | 70 } // namespace sync_preferences |
OLD | NEW |