OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "chrome/browser/sync/glue/preference_change_processor.h" | 5 #include "chrome/browser/sync/glue/preference_change_processor.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // preferences. | 113 // preferences. |
114 const wchar_t* pref_name = name.c_str(); | 114 const wchar_t* pref_name = name.c_str(); |
115 if (model_associator_->synced_preferences().count(pref_name) == 0) | 115 if (model_associator_->synced_preferences().count(pref_name) == 0) |
116 continue; | 116 continue; |
117 | 117 |
118 if (sync_api::SyncManager::ChangeRecord::ACTION_DELETE == | 118 if (sync_api::SyncManager::ChangeRecord::ACTION_DELETE == |
119 changes[i].action) { | 119 changes[i].action) { |
120 pref_service_->ClearPref(pref_name); | 120 pref_service_->ClearPref(pref_name); |
121 } else { | 121 } else { |
122 pref_service_->Set(pref_name, *value); | 122 pref_service_->Set(pref_name, *value); |
123 if (pref_name == prefs::kShowBookmarkBar) { | 123 if (0 == name.compare(prefs::kShowBookmarkBar)) { |
124 // If it was the bookmark bar, send an additional notification. | 124 // If it was the bookmark bar, send an additional notification. |
125 NotificationService::current()->Notify( | 125 NotificationService::current()->Notify( |
126 NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, | 126 NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, |
127 Source<PreferenceChangeProcessor>(this), | 127 Source<PreferenceChangeProcessor>(this), |
128 NotificationService::NoDetails()); | 128 NotificationService::NoDetails()); |
129 } | 129 } |
130 } | 130 } |
131 } | 131 } |
132 StartObserving(); | 132 StartObserving(); |
133 } | 133 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 void PreferenceChangeProcessor::StopObserving() { | 194 void PreferenceChangeProcessor::StopObserving() { |
195 DCHECK(pref_service_); | 195 DCHECK(pref_service_); |
196 for (std::set<std::wstring>::const_iterator it = | 196 for (std::set<std::wstring>::const_iterator it = |
197 model_associator_->synced_preferences().begin(); | 197 model_associator_->synced_preferences().begin(); |
198 it != model_associator_->synced_preferences().end(); ++it) { | 198 it != model_associator_->synced_preferences().end(); ++it) { |
199 pref_service_->RemovePrefObserver((*it).c_str(), this); | 199 pref_service_->RemovePrefObserver((*it).c_str(), this); |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 } // namespace browser_sync | 203 } // namespace browser_sync |
OLD | NEW |