| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 } | 320 } |
| 320 | 321 |
| 321 if (error.IsSet()) { | 322 if (error.IsSet()) { |
| 322 errors.push_back(error); | 323 errors.push_back(error); |
| 323 } | 324 } |
| 324 } | 325 } |
| 325 | 326 |
| 326 observers_->Notify( | 327 observers_->Notify( |
| 327 &SettingsObserver::OnSettingsChanged, | 328 &SettingsObserver::OnSettingsChanged, |
| 328 extension_id_, | 329 extension_id_, |
| 330 settings_namespace::SYNC, |
| 329 SettingChange::GetEventJson(changes)); | 331 SettingChange::GetEventJson(changes)); |
| 330 | 332 |
| 331 // TODO(kalman): Something sensible with multiple errors. | 333 // TODO(kalman): Something sensible with multiple errors. |
| 332 return errors.empty() ? SyncError() : errors[0]; | 334 return errors.empty() ? SyncError() : errors[0]; |
| 333 } | 335 } |
| 334 | 336 |
| 335 void SyncableSettingsStorage::SendChangesToSync( | 337 void SyncableSettingsStorage::SendChangesToSync( |
| 336 const SettingChangeList& changes) { | 338 const SettingChangeList& changes) { |
| 337 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 339 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 338 DCHECK(sync_processor_); | 340 DCHECK(sync_processor_); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 FROM_HERE, | 440 FROM_HERE, |
| 439 std::string("Error pushing sync remove to local settings: ") + | 441 std::string("Error pushing sync remove to local settings: ") + |
| 440 result.error(), | 442 result.error(), |
| 441 sync_type_); | 443 sync_type_); |
| 442 } | 444 } |
| 443 changes->push_back(SettingChange(key, old_value, NULL)); | 445 changes->push_back(SettingChange(key, old_value, NULL)); |
| 444 return SyncError(); | 446 return SyncError(); |
| 445 } | 447 } |
| 446 | 448 |
| 447 } // namespace extensions | 449 } // namespace extensions |
| OLD | NEW |