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/browser/extensions/extension_util.h" | 9 #include "chrome/browser/extensions/extension_util.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 void ExtensionSyncBundle::SetupSync( | 25 void ExtensionSyncBundle::SetupSync( |
26 syncer::SyncChangeProcessor* sync_processor, | 26 syncer::SyncChangeProcessor* sync_processor, |
27 syncer::SyncErrorFactory* sync_error_factory, | 27 syncer::SyncErrorFactory* sync_error_factory, |
28 const syncer::SyncDataList& initial_sync_data) { | 28 const syncer::SyncDataList& initial_sync_data) { |
29 sync_processor_.reset(sync_processor); | 29 sync_processor_.reset(sync_processor); |
30 sync_error_factory_.reset(sync_error_factory); | 30 sync_error_factory_.reset(sync_error_factory); |
31 | 31 |
32 for (syncer::SyncDataList::const_iterator i = initial_sync_data.begin(); | 32 for (syncer::SyncDataList::const_iterator i = initial_sync_data.begin(); |
33 i != initial_sync_data.end(); | 33 i != initial_sync_data.end(); |
34 ++i) { | 34 ++i) { |
35 ExtensionSyncData extension_sync_data(*i); | 35 scoped_ptr<ExtensionSyncData> extension_sync_data( |
36 AddExtension(extension_sync_data.id()); | 36 ExtensionSyncData::CreateFromSyncData(*i)); |
37 extension_sync_service_->ProcessExtensionSyncData(extension_sync_data); | 37 if (extension_sync_data.get()) { |
| 38 AddExtension(extension_sync_data->id()); |
| 39 extension_sync_service_->ProcessExtensionSyncData(*extension_sync_data); |
| 40 } |
38 } | 41 } |
39 } | 42 } |
40 | 43 |
41 void ExtensionSyncBundle::Reset() { | 44 void ExtensionSyncBundle::Reset() { |
42 sync_processor_.reset(); | 45 sync_processor_.reset(); |
43 sync_error_factory_.reset(); | 46 sync_error_factory_.reset(); |
44 synced_extensions_.clear(); | 47 synced_extensions_.clear(); |
45 pending_sync_data_.clear(); | 48 pending_sync_data_.clear(); |
46 } | 49 } |
47 | 50 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 void ExtensionSyncBundle::RemoveExtension(const std::string& id) { | 170 void ExtensionSyncBundle::RemoveExtension(const std::string& id) { |
168 synced_extensions_.erase(id); | 171 synced_extensions_.erase(id); |
169 } | 172 } |
170 | 173 |
171 void ExtensionSyncBundle::MarkPendingExtensionSynced(const std::string& id) { | 174 void ExtensionSyncBundle::MarkPendingExtensionSynced(const std::string& id) { |
172 pending_sync_data_.erase(id); | 175 pending_sync_data_.erase(id); |
173 synced_extensions_.insert(id); | 176 synced_extensions_.insert(id); |
174 } | 177 } |
175 | 178 |
176 } // namespace extensions | 179 } // namespace extensions |
OLD | NEW |