OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/prefs/pref_model_associator.h" | 5 #include "chrome/browser/prefs/pref_model_associator.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_string_value_serializer.h" | 9 #include "base/json/json_string_value_serializer.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 pref_service_(NULL) { | 26 pref_service_(NULL) { |
27 DCHECK(CalledOnValidThread()); | 27 DCHECK(CalledOnValidThread()); |
28 } | 28 } |
29 | 29 |
30 PrefModelAssociator::~PrefModelAssociator() { | 30 PrefModelAssociator::~PrefModelAssociator() { |
31 DCHECK(CalledOnValidThread()); | 31 DCHECK(CalledOnValidThread()); |
32 pref_service_ = NULL; | 32 pref_service_ = NULL; |
33 } | 33 } |
34 | 34 |
35 void PrefModelAssociator::InitPrefAndAssociate( | 35 void PrefModelAssociator::InitPrefAndAssociate( |
36 const SyncData& sync_pref, | 36 const csync::SyncData& sync_pref, |
37 const std::string& pref_name, | 37 const std::string& pref_name, |
38 SyncChangeList* sync_changes) { | 38 csync::SyncChangeList* sync_changes) { |
39 const PrefService::Preference* pref = | 39 const PrefService::Preference* pref = |
40 pref_service_->FindPreference(pref_name.c_str()); | 40 pref_service_->FindPreference(pref_name.c_str()); |
41 DCHECK(pref); | 41 DCHECK(pref); |
42 VLOG(1) << "Associating preference " << pref_name; | 42 VLOG(1) << "Associating preference " << pref_name; |
43 | 43 |
44 base::JSONReader reader; | 44 base::JSONReader reader; |
45 if (sync_pref.IsValid()) { | 45 if (sync_pref.IsValid()) { |
46 // The server has a value for the preference, we have to reconcile it with | 46 // The server has a value for the preference, we have to reconcile it with |
47 // ours. | 47 // ours. |
48 const sync_pb::PreferenceSpecifics& preference = | 48 const sync_pb::PreferenceSpecifics& preference = |
(...skipping 18 matching lines...) Expand all Loading... |
67 } else if (!new_value->IsType(pref->GetType())) { | 67 } else if (!new_value->IsType(pref->GetType())) { |
68 LOG(WARNING) << "Synced value for " << preference.name() | 68 LOG(WARNING) << "Synced value for " << preference.name() |
69 << " is of type " << new_value->GetType() | 69 << " is of type " << new_value->GetType() |
70 << " which doesn't match pref type " << pref->GetType(); | 70 << " which doesn't match pref type " << pref->GetType(); |
71 } else if (!pref->GetValue()->Equals(new_value.get())) { | 71 } else if (!pref->GetValue()->Equals(new_value.get())) { |
72 pref_service_->Set(pref_name.c_str(), *new_value); | 72 pref_service_->Set(pref_name.c_str(), *new_value); |
73 } | 73 } |
74 | 74 |
75 // If the merge resulted in an updated value, inform the syncer. | 75 // If the merge resulted in an updated value, inform the syncer. |
76 if (!value->Equals(new_value.get())) { | 76 if (!value->Equals(new_value.get())) { |
77 SyncData sync_data; | 77 csync::SyncData sync_data; |
78 if (!CreatePrefSyncData(pref->name(), *new_value, &sync_data)) { | 78 if (!CreatePrefSyncData(pref->name(), *new_value, &sync_data)) { |
79 LOG(ERROR) << "Failed to update preference."; | 79 LOG(ERROR) << "Failed to update preference."; |
80 return; | 80 return; |
81 } | 81 } |
82 sync_changes->push_back(SyncChange(SyncChange::ACTION_UPDATE, sync_data)); | 82 sync_changes->push_back( |
| 83 csync::SyncChange(csync::SyncChange::ACTION_UPDATE, sync_data)); |
83 } | 84 } |
84 } else if (pref->IsUserControlled()) { | 85 } else if (pref->IsUserControlled()) { |
85 // The server does not know about this preference and should be added | 86 // The server does not know about this preference and should be added |
86 // to the syncer's database. | 87 // to the syncer's database. |
87 SyncData sync_data; | 88 csync::SyncData sync_data; |
88 if (!CreatePrefSyncData(pref->name(), *pref->GetValue(), &sync_data)) { | 89 if (!CreatePrefSyncData(pref->name(), *pref->GetValue(), &sync_data)) { |
89 LOG(ERROR) << "Failed to update preference."; | 90 LOG(ERROR) << "Failed to update preference."; |
90 return; | 91 return; |
91 } | 92 } |
92 sync_changes->push_back(SyncChange(SyncChange::ACTION_ADD, sync_data)); | 93 sync_changes->push_back( |
| 94 csync::SyncChange(csync::SyncChange::ACTION_ADD, sync_data)); |
93 } else { | 95 } else { |
94 // This pref does not have a sync value but also does not have a user | 96 // This pref does not have a sync value but also does not have a user |
95 // controlled value (either it's a default value or it's policy controlled, | 97 // controlled value (either it's a default value or it's policy controlled, |
96 // either way it's not interesting). We can ignore it. Once it gets changed, | 98 // either way it's not interesting). We can ignore it. Once it gets changed, |
97 // we'll send the new user controlled value to the syncer. | 99 // we'll send the new user controlled value to the syncer. |
98 return; | 100 return; |
99 } | 101 } |
100 | 102 |
101 // Make sure we add it to our list of synced preferences so we know what | 103 // Make sure we add it to our list of synced preferences so we know what |
102 // the server is aware of. | 104 // the server is aware of. |
103 synced_preferences_.insert(pref_name); | 105 synced_preferences_.insert(pref_name); |
104 return; | 106 return; |
105 } | 107 } |
106 | 108 |
107 SyncError PrefModelAssociator::MergeDataAndStartSyncing( | 109 csync::SyncError PrefModelAssociator::MergeDataAndStartSyncing( |
108 syncable::ModelType type, | 110 syncable::ModelType type, |
109 const SyncDataList& initial_sync_data, | 111 const csync::SyncDataList& initial_sync_data, |
110 scoped_ptr<SyncChangeProcessor> sync_processor, | 112 scoped_ptr<csync::SyncChangeProcessor> sync_processor, |
111 scoped_ptr<SyncErrorFactory> sync_error_factory) { | 113 scoped_ptr<csync::SyncErrorFactory> sync_error_factory) { |
112 DCHECK_EQ(type, PREFERENCES); | 114 DCHECK_EQ(type, PREFERENCES); |
113 DCHECK(CalledOnValidThread()); | 115 DCHECK(CalledOnValidThread()); |
114 DCHECK(pref_service_); | 116 DCHECK(pref_service_); |
115 DCHECK(!sync_processor_.get()); | 117 DCHECK(!sync_processor_.get()); |
116 DCHECK(sync_processor.get()); | 118 DCHECK(sync_processor.get()); |
117 DCHECK(sync_error_factory.get()); | 119 DCHECK(sync_error_factory.get()); |
118 sync_processor_ = sync_processor.Pass(); | 120 sync_processor_ = sync_processor.Pass(); |
119 sync_error_factory_ = sync_error_factory.Pass(); | 121 sync_error_factory_ = sync_error_factory.Pass(); |
120 | 122 |
121 SyncChangeList new_changes; | 123 csync::SyncChangeList new_changes; |
122 std::set<std::string> remaining_preferences = registered_preferences_; | 124 std::set<std::string> remaining_preferences = registered_preferences_; |
123 | 125 |
124 // Go through and check for all preferences we care about that sync already | 126 // Go through and check for all preferences we care about that sync already |
125 // knows about. | 127 // knows about. |
126 for (SyncDataList::const_iterator sync_iter = initial_sync_data.begin(); | 128 for (csync::SyncDataList::const_iterator sync_iter = |
| 129 initial_sync_data.begin(); |
127 sync_iter != initial_sync_data.end(); | 130 sync_iter != initial_sync_data.end(); |
128 ++sync_iter) { | 131 ++sync_iter) { |
129 DCHECK_EQ(PREFERENCES, sync_iter->GetDataType()); | 132 DCHECK_EQ(PREFERENCES, sync_iter->GetDataType()); |
130 std::string sync_pref_name = sync_iter->GetSpecifics().preference().name(); | 133 std::string sync_pref_name = sync_iter->GetSpecifics().preference().name(); |
131 if (remaining_preferences.count(sync_pref_name) == 0) { | 134 if (remaining_preferences.count(sync_pref_name) == 0) { |
132 // We're not syncing this preference locally, ignore the sync data. | 135 // We're not syncing this preference locally, ignore the sync data. |
133 // TODO(zea): Eventually we want to be able to have the syncable service | 136 // TODO(zea): Eventually we want to be able to have the syncable service |
134 // reconstruct all sync data for it's datatype (therefore having | 137 // reconstruct all sync data for it's datatype (therefore having |
135 // GetAllSyncData be a complete representation). We should store this data | 138 // GetAllSyncData be a complete representation). We should store this data |
136 // somewhere, even if we don't use it. | 139 // somewhere, even if we don't use it. |
137 continue; | 140 continue; |
138 } | 141 } |
139 | 142 |
140 remaining_preferences.erase(sync_pref_name); | 143 remaining_preferences.erase(sync_pref_name); |
141 InitPrefAndAssociate(*sync_iter, sync_pref_name, &new_changes); | 144 InitPrefAndAssociate(*sync_iter, sync_pref_name, &new_changes); |
142 } | 145 } |
143 | 146 |
144 // Go through and build sync data for any remaining preferences. | 147 // Go through and build sync data for any remaining preferences. |
145 for (std::set<std::string>::iterator pref_name_iter = | 148 for (std::set<std::string>::iterator pref_name_iter = |
146 remaining_preferences.begin(); | 149 remaining_preferences.begin(); |
147 pref_name_iter != remaining_preferences.end(); | 150 pref_name_iter != remaining_preferences.end(); |
148 ++pref_name_iter) { | 151 ++pref_name_iter) { |
149 InitPrefAndAssociate(SyncData(), *pref_name_iter, &new_changes); | 152 InitPrefAndAssociate(csync::SyncData(), *pref_name_iter, &new_changes); |
150 } | 153 } |
151 | 154 |
152 // Push updates to sync. | 155 // Push updates to sync. |
153 SyncError error = | 156 csync::SyncError error = |
154 sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes); | 157 sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes); |
155 if (error.IsSet()) { | 158 if (error.IsSet()) { |
156 return error; | 159 return error; |
157 } | 160 } |
158 | 161 |
159 models_associated_ = true; | 162 models_associated_ = true; |
160 return SyncError(); | 163 return csync::SyncError(); |
161 } | 164 } |
162 | 165 |
163 void PrefModelAssociator::StopSyncing(syncable::ModelType type) { | 166 void PrefModelAssociator::StopSyncing(syncable::ModelType type) { |
164 DCHECK_EQ(type, PREFERENCES); | 167 DCHECK_EQ(type, PREFERENCES); |
165 models_associated_ = false; | 168 models_associated_ = false; |
166 sync_processor_.reset(); | 169 sync_processor_.reset(); |
167 sync_error_factory_.reset(); | 170 sync_error_factory_.reset(); |
168 } | 171 } |
169 | 172 |
170 Value* PrefModelAssociator::MergePreference( | 173 Value* PrefModelAssociator::MergePreference( |
(...skipping 12 matching lines...) Expand all Loading... |
183 return MergeDictionaryValues(*local_pref.GetValue(), server_value); | 186 return MergeDictionaryValues(*local_pref.GetValue(), server_value); |
184 } | 187 } |
185 | 188 |
186 // If this is not a specially handled preference, server wins. | 189 // If this is not a specially handled preference, server wins. |
187 return server_value.DeepCopy(); | 190 return server_value.DeepCopy(); |
188 } | 191 } |
189 | 192 |
190 bool PrefModelAssociator::CreatePrefSyncData( | 193 bool PrefModelAssociator::CreatePrefSyncData( |
191 const std::string& name, | 194 const std::string& name, |
192 const Value& value, | 195 const Value& value, |
193 SyncData* sync_data) { | 196 csync::SyncData* sync_data) { |
194 std::string serialized; | 197 std::string serialized; |
195 // TODO(zea): consider JSONWriter::Write since you don't have to check | 198 // TODO(zea): consider JSONWriter::Write since you don't have to check |
196 // failures to deserialize. | 199 // failures to deserialize. |
197 JSONStringValueSerializer json(&serialized); | 200 JSONStringValueSerializer json(&serialized); |
198 if (!json.Serialize(value)) { | 201 if (!json.Serialize(value)) { |
199 LOG(ERROR) << "Failed to serialize preference value."; | 202 LOG(ERROR) << "Failed to serialize preference value."; |
200 return false; | 203 return false; |
201 } | 204 } |
202 | 205 |
203 sync_pb::EntitySpecifics specifics; | 206 sync_pb::EntitySpecifics specifics; |
204 sync_pb::PreferenceSpecifics* pref_specifics = specifics.mutable_preference(); | 207 sync_pb::PreferenceSpecifics* pref_specifics = specifics.mutable_preference(); |
205 pref_specifics->set_name(name); | 208 pref_specifics->set_name(name); |
206 pref_specifics->set_value(serialized); | 209 pref_specifics->set_value(serialized); |
207 *sync_data = SyncData::CreateLocalData(name, name, specifics); | 210 *sync_data = csync::SyncData::CreateLocalData(name, name, specifics); |
208 return true; | 211 return true; |
209 } | 212 } |
210 | 213 |
211 Value* PrefModelAssociator::MergeListValues(const Value& from_value, | 214 Value* PrefModelAssociator::MergeListValues(const Value& from_value, |
212 const Value& to_value) { | 215 const Value& to_value) { |
213 if (from_value.GetType() == Value::TYPE_NULL) | 216 if (from_value.GetType() == Value::TYPE_NULL) |
214 return to_value.DeepCopy(); | 217 return to_value.DeepCopy(); |
215 if (to_value.GetType() == Value::TYPE_NULL) | 218 if (to_value.GetType() == Value::TYPE_NULL) |
216 return from_value.DeepCopy(); | 219 return from_value.DeepCopy(); |
217 | 220 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 result->SetWithoutPathExpansion(*key, from_value->DeepCopy()); | 266 result->SetWithoutPathExpansion(*key, from_value->DeepCopy()); |
264 } | 267 } |
265 } | 268 } |
266 return result; | 269 return result; |
267 } | 270 } |
268 | 271 |
269 // Note: This will build a model of all preferences registered as syncable | 272 // Note: This will build a model of all preferences registered as syncable |
270 // with user controlled data. We do not track any information for preferences | 273 // with user controlled data. We do not track any information for preferences |
271 // not registered locally as syncable and do not inform the syncer of | 274 // not registered locally as syncable and do not inform the syncer of |
272 // non-user controlled preferences. | 275 // non-user controlled preferences. |
273 SyncDataList PrefModelAssociator::GetAllSyncData(syncable::ModelType type) | 276 csync::SyncDataList PrefModelAssociator::GetAllSyncData( |
| 277 syncable::ModelType type) |
274 const { | 278 const { |
275 DCHECK_EQ(PREFERENCES, type); | 279 DCHECK_EQ(PREFERENCES, type); |
276 SyncDataList current_data; | 280 csync::SyncDataList current_data; |
277 for (PreferenceSet::const_iterator iter = synced_preferences_.begin(); | 281 for (PreferenceSet::const_iterator iter = synced_preferences_.begin(); |
278 iter != synced_preferences_.end(); | 282 iter != synced_preferences_.end(); |
279 ++iter) { | 283 ++iter) { |
280 std::string name = *iter; | 284 std::string name = *iter; |
281 const PrefService::Preference* pref = | 285 const PrefService::Preference* pref = |
282 pref_service_->FindPreference(name.c_str()); | 286 pref_service_->FindPreference(name.c_str()); |
283 DCHECK(pref); | 287 DCHECK(pref); |
284 if (!pref->IsUserControlled() || pref->IsDefaultValue()) | 288 if (!pref->IsUserControlled() || pref->IsDefaultValue()) |
285 continue; // This is not data we care about. | 289 continue; // This is not data we care about. |
286 // TODO(zea): plumb a way to read the user controlled value. | 290 // TODO(zea): plumb a way to read the user controlled value. |
287 SyncData sync_data; | 291 csync::SyncData sync_data; |
288 if (!CreatePrefSyncData(name, *pref->GetValue(), &sync_data)) | 292 if (!CreatePrefSyncData(name, *pref->GetValue(), &sync_data)) |
289 continue; | 293 continue; |
290 current_data.push_back(sync_data); | 294 current_data.push_back(sync_data); |
291 } | 295 } |
292 return current_data; | 296 return current_data; |
293 } | 297 } |
294 | 298 |
295 SyncError PrefModelAssociator::ProcessSyncChanges( | 299 csync::SyncError PrefModelAssociator::ProcessSyncChanges( |
296 const tracked_objects::Location& from_here, | 300 const tracked_objects::Location& from_here, |
297 const SyncChangeList& change_list) { | 301 const csync::SyncChangeList& change_list) { |
298 if (!models_associated_) { | 302 if (!models_associated_) { |
299 SyncError error(FROM_HERE, | 303 csync::SyncError error(FROM_HERE, |
300 "Models not yet associated.", | 304 "Models not yet associated.", |
301 PREFERENCES); | 305 PREFERENCES); |
302 return error; | 306 return error; |
303 } | 307 } |
304 AutoReset<bool> processing_changes(&processing_syncer_changes_, true); | 308 AutoReset<bool> processing_changes(&processing_syncer_changes_, true); |
305 SyncChangeList::const_iterator iter; | 309 csync::SyncChangeList::const_iterator iter; |
306 for (iter = change_list.begin(); iter != change_list.end(); ++iter) { | 310 for (iter = change_list.begin(); iter != change_list.end(); ++iter) { |
307 DCHECK_EQ(PREFERENCES, iter->sync_data().GetDataType()); | 311 DCHECK_EQ(PREFERENCES, iter->sync_data().GetDataType()); |
308 | 312 |
309 std::string name; | 313 std::string name; |
310 sync_pb::PreferenceSpecifics pref_specifics = | 314 sync_pb::PreferenceSpecifics pref_specifics = |
311 iter->sync_data().GetSpecifics().preference(); | 315 iter->sync_data().GetSpecifics().preference(); |
312 scoped_ptr<Value> value(ReadPreferenceSpecifics(pref_specifics, | 316 scoped_ptr<Value> value(ReadPreferenceSpecifics(pref_specifics, |
313 &name)); | 317 &name)); |
314 | 318 |
315 if (iter->change_type() == SyncChange::ACTION_DELETE) { | 319 if (iter->change_type() == csync::SyncChange::ACTION_DELETE) { |
316 // We never delete preferences. | 320 // We never delete preferences. |
317 NOTREACHED() << "Attempted to process sync delete change for " << name | 321 NOTREACHED() << "Attempted to process sync delete change for " << name |
318 << ". Skipping."; | 322 << ". Skipping."; |
319 continue; | 323 continue; |
320 } | 324 } |
321 | 325 |
322 // Skip values we can't deserialize. | 326 // Skip values we can't deserialize. |
323 // TODO(zea): consider taking some further action such as erasing the bad | 327 // TODO(zea): consider taking some further action such as erasing the bad |
324 // data. | 328 // data. |
325 if (!value.get()) | 329 if (!value.get()) |
(...skipping 10 matching lines...) Expand all Loading... |
336 const PrefService::Preference* pref = | 340 const PrefService::Preference* pref = |
337 pref_service_->FindPreference(pref_name); | 341 pref_service_->FindPreference(pref_name); |
338 DCHECK(pref); | 342 DCHECK(pref); |
339 | 343 |
340 // This will only modify the user controlled value store, which takes | 344 // This will only modify the user controlled value store, which takes |
341 // priority over the default value but is ignored if the preference is | 345 // priority over the default value but is ignored if the preference is |
342 // policy controlled. | 346 // policy controlled. |
343 pref_service_->Set(pref_name, *value); | 347 pref_service_->Set(pref_name, *value); |
344 | 348 |
345 // Keep track of any newly synced preferences. | 349 // Keep track of any newly synced preferences. |
346 if (iter->change_type() == SyncChange::ACTION_ADD) { | 350 if (iter->change_type() == csync::SyncChange::ACTION_ADD) { |
347 synced_preferences_.insert(name); | 351 synced_preferences_.insert(name); |
348 } | 352 } |
349 } | 353 } |
350 return SyncError(); | 354 return csync::SyncError(); |
351 } | 355 } |
352 | 356 |
353 Value* PrefModelAssociator::ReadPreferenceSpecifics( | 357 Value* PrefModelAssociator::ReadPreferenceSpecifics( |
354 const sync_pb::PreferenceSpecifics& preference, | 358 const sync_pb::PreferenceSpecifics& preference, |
355 std::string* name) { | 359 std::string* name) { |
356 base::JSONReader reader; | 360 base::JSONReader reader; |
357 scoped_ptr<Value> value(reader.ReadToValue(preference.value())); | 361 scoped_ptr<Value> value(reader.ReadToValue(preference.value())); |
358 if (!value.get()) { | 362 if (!value.get()) { |
359 std::string err = "Failed to deserialize preference value: " + | 363 std::string err = "Failed to deserialize preference value: " + |
360 reader.GetErrorMessage(); | 364 reader.GetErrorMessage(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 return; | 396 return; |
393 | 397 |
394 const PrefService::Preference* preference = | 398 const PrefService::Preference* preference = |
395 pref_service_->FindPreference(name.c_str()); | 399 pref_service_->FindPreference(name.c_str()); |
396 if (!preference) | 400 if (!preference) |
397 return; | 401 return; |
398 | 402 |
399 if (!IsPrefRegistered(name.c_str())) | 403 if (!IsPrefRegistered(name.c_str())) |
400 return; // We are not syncing this preference. | 404 return; // We are not syncing this preference. |
401 | 405 |
402 SyncChangeList changes; | 406 csync::SyncChangeList changes; |
403 | 407 |
404 if (!preference->IsUserModifiable()) { | 408 if (!preference->IsUserModifiable()) { |
405 // If the preference is no longer user modifiable, it must now be controlled | 409 // If the preference is no longer user modifiable, it must now be controlled |
406 // by policy, whose values we do not sync. Just return. If the preference | 410 // by policy, whose values we do not sync. Just return. If the preference |
407 // stops being controlled by policy, it will revert back to the user value | 411 // stops being controlled by policy, it will revert back to the user value |
408 // (which we continue to update with sync changes). | 412 // (which we continue to update with sync changes). |
409 return; | 413 return; |
410 } | 414 } |
411 | 415 |
412 AutoReset<bool> processing_changes(&processing_syncer_changes_, true); | 416 AutoReset<bool> processing_changes(&processing_syncer_changes_, true); |
413 | 417 |
414 if (synced_preferences_.count(name) == 0) { | 418 if (synced_preferences_.count(name) == 0) { |
415 // Not in synced_preferences_ means no synced data. InitPrefAndAssociate(..) | 419 // Not in synced_preferences_ means no synced data. InitPrefAndAssociate(..) |
416 // will determine if we care about its data (e.g. if it has a default value | 420 // will determine if we care about its data (e.g. if it has a default value |
417 // and hasn't been changed yet we don't) and take care syncing any new data. | 421 // and hasn't been changed yet we don't) and take care syncing any new data. |
418 InitPrefAndAssociate(SyncData(), name, &changes); | 422 InitPrefAndAssociate(csync::SyncData(), name, &changes); |
419 } else { | 423 } else { |
420 // We are already syncing this preference, just update it's sync node. | 424 // We are already syncing this preference, just update it's sync node. |
421 SyncData sync_data; | 425 csync::SyncData sync_data; |
422 if (!CreatePrefSyncData(name, *preference->GetValue(), &sync_data)) { | 426 if (!CreatePrefSyncData(name, *preference->GetValue(), &sync_data)) { |
423 LOG(ERROR) << "Failed to update preference."; | 427 LOG(ERROR) << "Failed to update preference."; |
424 return; | 428 return; |
425 } | 429 } |
426 changes.push_back(SyncChange(SyncChange::ACTION_UPDATE, sync_data)); | 430 changes.push_back( |
| 431 csync::SyncChange(csync::SyncChange::ACTION_UPDATE, sync_data)); |
427 } | 432 } |
428 | 433 |
429 SyncError error = | 434 csync::SyncError error = |
430 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); | 435 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); |
431 } | 436 } |
432 | 437 |
433 void PrefModelAssociator::SetPrefService(PrefService* pref_service) { | 438 void PrefModelAssociator::SetPrefService(PrefService* pref_service) { |
434 DCHECK(pref_service_ == NULL); | 439 DCHECK(pref_service_ == NULL); |
435 pref_service_ = pref_service; | 440 pref_service_ = pref_service; |
436 } | 441 } |
OLD | NEW |