| 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 current_data.push_back(sync_data); | 341 current_data.push_back(sync_data); |
| 342 } | 342 } |
| 343 return current_data; | 343 return current_data; |
| 344 } | 344 } |
| 345 | 345 |
| 346 syncer::SyncError PrefModelAssociator::ProcessSyncChanges( | 346 syncer::SyncError PrefModelAssociator::ProcessSyncChanges( |
| 347 const tracked_objects::Location& from_here, | 347 const tracked_objects::Location& from_here, |
| 348 const syncer::SyncChangeList& change_list) { | 348 const syncer::SyncChangeList& change_list) { |
| 349 if (!models_associated_) { | 349 if (!models_associated_) { |
| 350 syncer::SyncError error(FROM_HERE, | 350 syncer::SyncError error(FROM_HERE, |
| 351 "Models not yet associated.", | 351 syncer::SyncError::DATATYPE_ERROR, |
| 352 PREFERENCES); | 352 "Models not yet associated.", |
| 353 PREFERENCES); |
| 353 return error; | 354 return error; |
| 354 } | 355 } |
| 355 base::AutoReset<bool> processing_changes(&processing_syncer_changes_, true); | 356 base::AutoReset<bool> processing_changes(&processing_syncer_changes_, true); |
| 356 syncer::SyncChangeList::const_iterator iter; | 357 syncer::SyncChangeList::const_iterator iter; |
| 357 for (iter = change_list.begin(); iter != change_list.end(); ++iter) { | 358 for (iter = change_list.begin(); iter != change_list.end(); ++iter) { |
| 358 DCHECK_EQ(type_, iter->sync_data().GetDataType()); | 359 DCHECK_EQ(type_, iter->sync_data().GetDataType()); |
| 359 | 360 |
| 360 std::string name; | 361 std::string name; |
| 361 const sync_pb::PreferenceSpecifics& pref_specifics = | 362 const sync_pb::PreferenceSpecifics& pref_specifics = |
| 362 GetSpecifics(iter->sync_data()); | 363 GetSpecifics(iter->sync_data()); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 } | 482 } |
| 482 | 483 |
| 483 syncer::SyncError error = | 484 syncer::SyncError error = |
| 484 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); | 485 sync_processor_->ProcessSyncChanges(FROM_HERE, changes); |
| 485 } | 486 } |
| 486 | 487 |
| 487 void PrefModelAssociator::SetPrefService(PrefServiceSyncable* pref_service) { | 488 void PrefModelAssociator::SetPrefService(PrefServiceSyncable* pref_service) { |
| 488 DCHECK(pref_service_ == NULL); | 489 DCHECK(pref_service_ == NULL); |
| 489 pref_service_ = pref_service; | 490 pref_service_ = pref_service; |
| 490 } | 491 } |
| OLD | NEW |