| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/sync_bundle.h" | 5 #include "chrome/browser/extensions/sync_bundle.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "chrome/browser/extensions/extension_sync_data.h" | 8 #include "chrome/browser/extensions/extension_sync_data.h" |
| 9 #include "chrome/browser/extensions/extension_sync_service.h" | 9 #include "chrome/browser/extensions/extension_sync_service.h" |
| 10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 void SyncBundle::PushSyncDeletion(const std::string& extension_id, | 72 void SyncBundle::PushSyncDeletion(const std::string& extension_id, |
| 73 const syncer::SyncData& sync_data) { | 73 const syncer::SyncData& sync_data) { |
| 74 RemoveSyncedExtension(extension_id); | 74 RemoveSyncedExtension(extension_id); |
| 75 PushSyncChanges(syncer::SyncChangeList(1, | 75 PushSyncChanges(syncer::SyncChangeList(1, |
| 76 syncer::SyncChange(FROM_HERE, | 76 syncer::SyncChange(FROM_HERE, |
| 77 syncer::SyncChange::ACTION_DELETE, | 77 syncer::SyncChange::ACTION_DELETE, |
| 78 sync_data))); | 78 sync_data))); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void SyncBundle::PushSyncChangeIfNeeded(const Extension& extension) { | 81 void SyncBundle::PushSyncAddOrUpdate(const Extension& extension) { |
| 82 syncer::SyncChangeList sync_change_list( | 82 syncer::SyncChangeList sync_change_list( |
| 83 1, | 83 1, |
| 84 CreateSyncChange(extension.id(), | 84 CreateSyncChange(extension.id(), |
| 85 sync_service_->CreateSyncData(extension).GetSyncData())); | 85 sync_service_->CreateSyncData(extension).GetSyncData())); |
| 86 PushSyncChanges(sync_change_list); | 86 PushSyncChanges(sync_change_list); |
| 87 MarkPendingExtensionSynced(extension.id()); | 87 MarkPendingExtensionSynced(extension.id()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void SyncBundle::ApplySyncChange(const syncer::SyncChange& sync_change) { | 90 void SyncBundle::ApplySyncChange(const syncer::SyncChange& sync_change) { |
| 91 scoped_ptr<ExtensionSyncData> extension_sync_data( | 91 scoped_ptr<ExtensionSyncData> extension_sync_data( |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 void SyncBundle::RemoveSyncedExtension(const std::string& id) { | 140 void SyncBundle::RemoveSyncedExtension(const std::string& id) { |
| 141 synced_extensions_.erase(id); | 141 synced_extensions_.erase(id); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void SyncBundle::MarkPendingExtensionSynced(const std::string& id) { | 144 void SyncBundle::MarkPendingExtensionSynced(const std::string& id) { |
| 145 pending_sync_data_.erase(id); | 145 pending_sync_data_.erase(id); |
| 146 AddSyncedExtension(id); | 146 AddSyncedExtension(id); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace extensions | 149 } // namespace extensions |
| OLD | NEW |