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