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/extension_sync_bundle.h" | 5 #include "chrome/browser/extensions/extension_sync_bundle.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "chrome/browser/extensions/extension_sync_service.h" | 8 #include "chrome/browser/extensions/extension_sync_service.h" |
9 #include "chrome/common/extensions/sync_helper.h" | 9 #include "chrome/common/extensions/sync_helper.h" |
10 #include "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 void ExtensionSyncBundle::ProcessDeletion( | 53 void ExtensionSyncBundle::ProcessDeletion( |
54 std::string extension_id, const syncer::SyncChange& sync_change) { | 54 std::string extension_id, const syncer::SyncChange& sync_change) { |
55 RemoveExtension(extension_id); | 55 RemoveExtension(extension_id); |
56 sync_processor_->ProcessSyncChanges(FROM_HERE, | 56 sync_processor_->ProcessSyncChanges(FROM_HERE, |
57 syncer::SyncChangeList(1, sync_change)); | 57 syncer::SyncChangeList(1, sync_change)); |
58 } | 58 } |
59 | 59 |
60 syncer::SyncChange ExtensionSyncBundle::CreateSyncChange( | 60 syncer::SyncChange ExtensionSyncBundle::CreateSyncChange( |
61 const syncer::SyncData& sync_data) { | 61 const syncer::SyncData& sync_data) { |
62 if (HasExtensionId(sync_data.GetTag())) { | 62 const syncer::SyncDataLocal sync_data_local(sync_data); |
| 63 if (HasExtensionId(sync_data_local.GetTag())) { |
63 return syncer::SyncChange(FROM_HERE, | 64 return syncer::SyncChange(FROM_HERE, |
64 syncer::SyncChange::ACTION_UPDATE, | 65 syncer::SyncChange::ACTION_UPDATE, |
65 sync_data); | 66 sync_data); |
66 } else { | 67 } else { |
67 AddExtension(sync_data.GetTag()); | 68 AddExtension(sync_data_local.GetTag()); |
68 return syncer::SyncChange(FROM_HERE, | 69 return syncer::SyncChange(FROM_HERE, |
69 syncer::SyncChange::ACTION_ADD, | 70 syncer::SyncChange::ACTION_ADD, |
70 sync_data); | 71 sync_data); |
71 } | 72 } |
72 } | 73 } |
73 | 74 |
74 syncer::SyncDataList ExtensionSyncBundle::GetAllSyncData() const { | 75 syncer::SyncDataList ExtensionSyncBundle::GetAllSyncData() const { |
75 std::vector<ExtensionSyncData> extension_sync_data = | 76 std::vector<ExtensionSyncData> extension_sync_data = |
76 extension_sync_service_->GetExtensionSyncDataList(); | 77 extension_sync_service_->GetExtensionSyncDataList(); |
77 syncer::SyncDataList result(extension_sync_data.size()); | 78 syncer::SyncDataList result(extension_sync_data.size()); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 void ExtensionSyncBundle::RemoveExtension(const std::string& id) { | 163 void ExtensionSyncBundle::RemoveExtension(const std::string& id) { |
163 synced_extensions_.erase(id); | 164 synced_extensions_.erase(id); |
164 } | 165 } |
165 | 166 |
166 void ExtensionSyncBundle::MarkPendingExtensionSynced(const std::string& id) { | 167 void ExtensionSyncBundle::MarkPendingExtensionSynced(const std::string& id) { |
167 pending_sync_data_.erase(id); | 168 pending_sync_data_.erase(id); |
168 synced_extensions_.insert(id); | 169 synced_extensions_.insert(id); |
169 } | 170 } |
170 | 171 |
171 } // namespace extensions | 172 } // namespace extensions |
OLD | NEW |