| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/settings/syncable_settings_storage.h" | 5 #include "chrome/browser/extensions/settings/syncable_settings_storage.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "chrome/browser/extensions/settings/settings_namespace.h" |
| 8 #include "chrome/browser/extensions/settings/settings_sync_util.h" | 9 #include "chrome/browser/extensions/settings/settings_sync_util.h" |
| 9 #include "chrome/browser/sync/api/sync_data.h" | 10 #include "chrome/browser/sync/api/sync_data.h" |
| 10 #include "chrome/browser/sync/protocol/extension_setting_specifics.pb.h" | 11 #include "chrome/browser/sync/protocol/extension_setting_specifics.pb.h" |
| 11 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 12 | 13 |
| 13 namespace extensions { | 14 namespace extensions { |
| 14 | 15 |
| 15 using content::BrowserThread; | 16 using content::BrowserThread; |
| 16 | 17 |
| 17 SyncableSettingsStorage::SyncableSettingsStorage( | 18 SyncableSettingsStorage::SyncableSettingsStorage( |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 315 } |
| 315 | 316 |
| 316 if (error.IsSet()) { | 317 if (error.IsSet()) { |
| 317 errors.push_back(error); | 318 errors.push_back(error); |
| 318 } | 319 } |
| 319 } | 320 } |
| 320 | 321 |
| 321 observers_->Notify( | 322 observers_->Notify( |
| 322 &SettingsObserver::OnSettingsChanged, | 323 &SettingsObserver::OnSettingsChanged, |
| 323 extension_id_, | 324 extension_id_, |
| 325 settings_namespace::SYNC, |
| 324 SettingChange::GetEventJson(changes)); | 326 SettingChange::GetEventJson(changes)); |
| 325 | 327 |
| 326 // TODO(kalman): Something sensible with multiple errors. | 328 // TODO(kalman): Something sensible with multiple errors. |
| 327 return errors.empty() ? SyncError() : errors[0]; | 329 return errors.empty() ? SyncError() : errors[0]; |
| 328 } | 330 } |
| 329 | 331 |
| 330 void SyncableSettingsStorage::SendChangesToSync( | 332 void SyncableSettingsStorage::SendChangesToSync( |
| 331 const SettingChangeList& changes) { | 333 const SettingChangeList& changes) { |
| 332 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 334 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 333 DCHECK(sync_processor_); | 335 DCHECK(sync_processor_); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 FROM_HERE, | 435 FROM_HERE, |
| 434 std::string("Error pushing sync remove to local settings: ") + | 436 std::string("Error pushing sync remove to local settings: ") + |
| 435 result.error(), | 437 result.error(), |
| 436 sync_type_); | 438 sync_type_); |
| 437 } | 439 } |
| 438 changes->push_back(SettingChange(key, old_value, NULL)); | 440 changes->push_back(SettingChange(key, old_value, NULL)); |
| 439 return SyncError(); | 441 return SyncError(); |
| 440 } | 442 } |
| 441 | 443 |
| 442 } // namespace extensions | 444 } // namespace extensions |
| OLD | NEW |