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

Side by Side Diff: chrome/browser/extensions/app_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/app_sync_bundle.h" 5 #include "chrome/browser/extensions/app_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 15 matching lines...) Expand all
26 void AppSyncBundle::SetupSync( 26 void AppSyncBundle::SetupSync(
27 syncer::SyncChangeProcessor* sync_change_processor, 27 syncer::SyncChangeProcessor* sync_change_processor,
28 syncer::SyncErrorFactory* sync_error_factory, 28 syncer::SyncErrorFactory* sync_error_factory,
29 const syncer::SyncDataList& initial_sync_data) { 29 const syncer::SyncDataList& initial_sync_data) {
30 sync_processor_.reset(sync_change_processor); 30 sync_processor_.reset(sync_change_processor);
31 sync_error_factory_.reset(sync_error_factory); 31 sync_error_factory_.reset(sync_error_factory);
32 32
33 for (syncer::SyncDataList::const_iterator i = initial_sync_data.begin(); 33 for (syncer::SyncDataList::const_iterator i = initial_sync_data.begin();
34 i != initial_sync_data.end(); 34 i != initial_sync_data.end();
35 ++i) { 35 ++i) {
36 AppSyncData app_sync_data(*i); 36 scoped_ptr<AppSyncData> app_sync_data(AppSyncData::CreateFromSyncData(*i));
37 AddApp(app_sync_data.id()); 37 if (app_sync_data.get()) {
38 extension_sync_service_->ProcessAppSyncData(app_sync_data); 38 AddApp(app_sync_data->id());
39 extension_sync_service_->ProcessAppSyncData(*app_sync_data);
40 }
39 } 41 }
40 } 42 }
41 43
42 void AppSyncBundle::Reset() { 44 void AppSyncBundle::Reset() {
43 sync_processor_.reset(); 45 sync_processor_.reset();
44 sync_error_factory_.reset(); 46 sync_error_factory_.reset();
45 synced_apps_.clear(); 47 synced_apps_.clear();
46 pending_sync_data_.clear(); 48 pending_sync_data_.clear();
47 } 49 }
48 50
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 170 }
169 171
170 172
171 void AppSyncBundle::MarkPendingAppSynced(const std::string& id) { 173 void AppSyncBundle::MarkPendingAppSynced(const std::string& id) {
172 pending_sync_data_.erase(id); 174 pending_sync_data_.erase(id);
173 synced_apps_.insert(id); 175 synced_apps_.insert(id);
174 } 176 }
175 177
176 178
177 } // namespace extensions 179 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/apps/ephemeral_app_browsertest.cc ('k') | chrome/browser/extensions/app_sync_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698