| 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/extensions/api/storage/syncable_settings_storage.h" | 5 #include "chrome/browser/extensions/api/storage/syncable_settings_storage.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "chrome/browser/extensions/api/storage/settings_sync_processor.h" | 8 #include "chrome/browser/extensions/api/storage/settings_sync_processor.h" |
| 9 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" | 9 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 NOTREACHED(); | 349 NOTREACHED(); |
| 350 } | 350 } |
| 351 | 351 |
| 352 if (error.IsSet()) { | 352 if (error.IsSet()) { |
| 353 errors.push_back(error); | 353 errors.push_back(error); |
| 354 } | 354 } |
| 355 } | 355 } |
| 356 | 356 |
| 357 sync_processor_->NotifyChanges(changes); | 357 sync_processor_->NotifyChanges(changes); |
| 358 | 358 |
| 359 observers_->Notify( | 359 observers_->Notify(FROM_HERE, &SettingsObserver::OnSettingsChanged, |
| 360 &SettingsObserver::OnSettingsChanged, | 360 extension_id_, settings_namespace::SYNC, |
| 361 extension_id_, | 361 ValueStoreChange::ToJson(changes)); |
| 362 settings_namespace::SYNC, | |
| 363 ValueStoreChange::ToJson(changes)); | |
| 364 | 362 |
| 365 // TODO(kalman): Something sensible with multiple errors. | 363 // TODO(kalman): Something sensible with multiple errors. |
| 366 return errors.empty() ? syncer::SyncError() : errors[0]; | 364 return errors.empty() ? syncer::SyncError() : errors[0]; |
| 367 } | 365 } |
| 368 | 366 |
| 369 syncer::SyncError SyncableSettingsStorage::OnSyncAdd( | 367 syncer::SyncError SyncableSettingsStorage::OnSyncAdd( |
| 370 const std::string& key, | 368 const std::string& key, |
| 371 base::Value* new_value, | 369 base::Value* new_value, |
| 372 ValueStoreChangeList* changes) { | 370 ValueStoreChangeList* changes) { |
| 373 DCHECK(new_value); | 371 DCHECK(new_value); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 syncer::SyncError::DATATYPE_ERROR, | 414 syncer::SyncError::DATATYPE_ERROR, |
| 417 base::StringPrintf("Error pushing sync remove to local settings: %s", | 415 base::StringPrintf("Error pushing sync remove to local settings: %s", |
| 418 result->error().message.c_str()), | 416 result->error().message.c_str()), |
| 419 sync_processor_->type()); | 417 sync_processor_->type()); |
| 420 } | 418 } |
| 421 changes->push_back(ValueStoreChange(key, old_value, NULL)); | 419 changes->push_back(ValueStoreChange(key, old_value, NULL)); |
| 422 return syncer::SyncError(); | 420 return syncer::SyncError(); |
| 423 } | 421 } |
| 424 | 422 |
| 425 } // namespace extensions | 423 } // namespace extensions |
| OLD | NEW |