Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/extensions/extension_sync_bundle.cc

Issue 996213005: Don't crash when trying to create an ExtensionSyncData from invalid SyncData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: kalmanize Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/extensions/extension_sync_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698