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_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_sorting.h" | 9 #include "chrome/browser/extensions/extension_sorting.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 void ExtensionSyncBundle::ProcessDeletion( | 52 void ExtensionSyncBundle::ProcessDeletion( |
53 std::string extension_id, const syncer::SyncChange& sync_change) { | 53 std::string extension_id, const syncer::SyncChange& sync_change) { |
54 RemoveExtension(extension_id); | 54 RemoveExtension(extension_id); |
55 sync_processor_->ProcessSyncChanges(FROM_HERE, | 55 sync_processor_->ProcessSyncChanges(FROM_HERE, |
56 syncer::SyncChangeList(1, sync_change)); | 56 syncer::SyncChangeList(1, sync_change)); |
57 } | 57 } |
58 | 58 |
59 syncer::SyncChange ExtensionSyncBundle::CreateSyncChange( | 59 syncer::SyncChange ExtensionSyncBundle::CreateSyncChange( |
60 const syncer::SyncData& sync_data) { | 60 const syncer::SyncData& sync_data) { |
61 if (HasExtensionId(sync_data.GetTag())) { | 61 if (HasExtensionId(sync_data.GetTag())) { |
62 return syncer::SyncChange(syncer::SyncChange::ACTION_UPDATE, sync_data); | 62 return syncer::SyncChange(FROM_HERE, |
| 63 syncer::SyncChange::ACTION_UPDATE, |
| 64 sync_data); |
63 } else { | 65 } else { |
64 AddExtension(sync_data.GetTag()); | 66 AddExtension(sync_data.GetTag()); |
65 return syncer::SyncChange(syncer::SyncChange::ACTION_ADD, sync_data); | 67 return syncer::SyncChange(FROM_HERE, |
| 68 syncer::SyncChange::ACTION_ADD, |
| 69 sync_data); |
66 } | 70 } |
67 } | 71 } |
68 | 72 |
69 syncer::SyncDataList ExtensionSyncBundle::GetAllSyncData() const { | 73 syncer::SyncDataList ExtensionSyncBundle::GetAllSyncData() const { |
70 std::vector<ExtensionSyncData> extension_sync_data = | 74 std::vector<ExtensionSyncData> extension_sync_data = |
71 extension_service_->GetExtensionSyncDataList(); | 75 extension_service_->GetExtensionSyncDataList(); |
72 syncer::SyncDataList result(extension_sync_data.size()); | 76 syncer::SyncDataList result(extension_sync_data.size()); |
73 for (int i = 0; i < static_cast<int>(extension_sync_data.size()); ++i) { | 77 for (int i = 0; i < static_cast<int>(extension_sync_data.size()); ++i) { |
74 result[i] = extension_sync_data[i].GetSyncData(); | 78 result[i] = extension_sync_data[i].GetSyncData(); |
75 } | 79 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 void ExtensionSyncBundle::RemoveExtension(const std::string& id) { | 162 void ExtensionSyncBundle::RemoveExtension(const std::string& id) { |
159 synced_extensions_.erase(id); | 163 synced_extensions_.erase(id); |
160 } | 164 } |
161 | 165 |
162 void ExtensionSyncBundle::MarkPendingExtensionSynced(const std::string& id) { | 166 void ExtensionSyncBundle::MarkPendingExtensionSynced(const std::string& id) { |
163 pending_sync_data_.erase(id); | 167 pending_sync_data_.erase(id); |
164 synced_extensions_.insert(id); | 168 synced_extensions_.insert(id); |
165 } | 169 } |
166 | 170 |
167 } // namespace extensions | 171 } // namespace extensions |
OLD | NEW |