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

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

Issue 10698141: Revert 145993 - [Sync] Add location parameter to SyncChange in Sync API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
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_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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 void ExtensionSyncBundle::ProcessDeletion( 52 void ExtensionSyncBundle::ProcessDeletion(
53 std::string extension_id, const syncer::SyncChange& sync_change) { 53 std::string extension_id, const syncer::SyncChange& sync_change) {
54 RemoveExtension(extension_id); 54 RemoveExtension(extension_id);
55 sync_processor_->ProcessSyncChanges(FROM_HERE, 55 sync_processor_->ProcessSyncChanges(FROM_HERE,
56 syncer::SyncChangeList(1, sync_change)); 56 syncer::SyncChangeList(1, sync_change));
57 } 57 }
58 58
59 syncer::SyncChange ExtensionSyncBundle::CreateSyncChange( 59 syncer::SyncChange ExtensionSyncBundle::CreateSyncChange(
60 const syncer::SyncData& sync_data) { 60 const syncer::SyncData& sync_data) {
61 if (HasExtensionId(sync_data.GetTag())) { 61 if (HasExtensionId(sync_data.GetTag())) {
62 return syncer::SyncChange(FROM_HERE, 62 return syncer::SyncChange(syncer::SyncChange::ACTION_UPDATE, sync_data);
63 syncer::SyncChange::ACTION_UPDATE,
64 sync_data);
65 } else { 63 } else {
66 AddExtension(sync_data.GetTag()); 64 AddExtension(sync_data.GetTag());
67 return syncer::SyncChange(FROM_HERE, 65 return syncer::SyncChange(syncer::SyncChange::ACTION_ADD, sync_data);
68 syncer::SyncChange::ACTION_ADD,
69 sync_data);
70 } 66 }
71 } 67 }
72 68
73 syncer::SyncDataList ExtensionSyncBundle::GetAllSyncData() const { 69 syncer::SyncDataList ExtensionSyncBundle::GetAllSyncData() const {
74 std::vector<ExtensionSyncData> extension_sync_data = 70 std::vector<ExtensionSyncData> extension_sync_data =
75 extension_service_->GetExtensionSyncDataList(); 71 extension_service_->GetExtensionSyncDataList();
76 syncer::SyncDataList result(extension_sync_data.size()); 72 syncer::SyncDataList result(extension_sync_data.size());
77 for (int i = 0; i < static_cast<int>(extension_sync_data.size()); ++i) { 73 for (int i = 0; i < static_cast<int>(extension_sync_data.size()); ++i) {
78 result[i] = extension_sync_data[i].GetSyncData(); 74 result[i] = extension_sync_data[i].GetSyncData();
79 } 75 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 void ExtensionSyncBundle::RemoveExtension(const std::string& id) { 158 void ExtensionSyncBundle::RemoveExtension(const std::string& id) {
163 synced_extensions_.erase(id); 159 synced_extensions_.erase(id);
164 } 160 }
165 161
166 void ExtensionSyncBundle::MarkPendingExtensionSynced(const std::string& id) { 162 void ExtensionSyncBundle::MarkPendingExtensionSynced(const std::string& id) {
167 pending_sync_data_.erase(id); 163 pending_sync_data_.erase(id);
168 synced_extensions_.insert(id); 164 synced_extensions_.insert(id);
169 } 165 }
170 166
171 } // namespace extensions 167 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/extensions/extension_sync_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698