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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 | 137 |
138 return pending_extensions; | 138 return pending_extensions; |
139 } | 139 } |
140 | 140 |
141 void ExtensionSyncBundle::GetExtensionSyncDataListHelper( | 141 void ExtensionSyncBundle::GetExtensionSyncDataListHelper( |
142 const ExtensionSet& extensions, | 142 const ExtensionSet& extensions, |
143 std::vector<ExtensionSyncData>* sync_data_list) const { | 143 std::vector<ExtensionSyncData>* sync_data_list) const { |
144 for (ExtensionSet::const_iterator it = extensions.begin(); | 144 for (ExtensionSet::const_iterator it = extensions.begin(); |
145 it != extensions.end(); ++it) { | 145 it != extensions.end(); ++it) { |
146 const Extension& extension = **it; | 146 const Extension& extension = **it.get(); |
147 // If we have pending extension data for this extension, then this | 147 // If we have pending extension data for this extension, then this |
148 // version is out of date. We'll sync back the version we got from | 148 // version is out of date. We'll sync back the version we got from |
149 // sync. | 149 // sync. |
150 if (HandlesExtension(extension) && | 150 if (HandlesExtension(extension) && |
151 !HasPendingExtensionId(extension.id())) { | 151 !HasPendingExtensionId(extension.id())) { |
152 sync_data_list->push_back( | 152 sync_data_list->push_back( |
153 extension_service_->GetExtensionSyncData(extension)); | 153 extension_service_->GetExtensionSyncData(extension)); |
154 } | 154 } |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 void ExtensionSyncBundle::AddExtension(const std::string& id) { | 158 void ExtensionSyncBundle::AddExtension(const std::string& id) { |
159 synced_extensions_.insert(id); | 159 synced_extensions_.insert(id); |
160 } | 160 } |
161 | 161 |
162 void ExtensionSyncBundle::RemoveExtension(const std::string& id) { | 162 void ExtensionSyncBundle::RemoveExtension(const std::string& id) { |
163 synced_extensions_.erase(id); | 163 synced_extensions_.erase(id); |
164 } | 164 } |
165 | 165 |
166 void ExtensionSyncBundle::MarkPendingExtensionSynced(const std::string& id) { | 166 void ExtensionSyncBundle::MarkPendingExtensionSynced(const std::string& id) { |
167 pending_sync_data_.erase(id); | 167 pending_sync_data_.erase(id); |
168 synced_extensions_.insert(id); | 168 synced_extensions_.insert(id); |
169 } | 169 } |
170 | 170 |
171 } // namespace extensions | 171 } // namespace extensions |
OLD | NEW |