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

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

Issue 10690128: Reland r145993. (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/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_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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 void AppSyncBundle::ProcessDeletion(std::string extension_id, 53 void AppSyncBundle::ProcessDeletion(std::string extension_id,
54 const syncer::SyncChange& sync_change) { 54 const syncer::SyncChange& sync_change) {
55 RemoveApp(extension_id); 55 RemoveApp(extension_id);
56 sync_processor_->ProcessSyncChanges(FROM_HERE, 56 sync_processor_->ProcessSyncChanges(FROM_HERE,
57 syncer::SyncChangeList(1, sync_change)); 57 syncer::SyncChangeList(1, sync_change));
58 } 58 }
59 59
60 syncer::SyncChange AppSyncBundle::CreateSyncChange( 60 syncer::SyncChange AppSyncBundle::CreateSyncChange(
61 const syncer::SyncData& sync_data) { 61 const syncer::SyncData& sync_data) {
62 if (HasExtensionId(sync_data.GetTag())) { 62 if (HasExtensionId(sync_data.GetTag())) {
63 return syncer::SyncChange(syncer::SyncChange::ACTION_UPDATE, sync_data); 63 return syncer::SyncChange(FROM_HERE,
64 syncer::SyncChange::ACTION_UPDATE,
65 sync_data);
64 } else { 66 } else {
65 AddApp(sync_data.GetTag()); 67 AddApp(sync_data.GetTag());
66 return syncer::SyncChange(syncer::SyncChange::ACTION_ADD, sync_data); 68 return syncer::SyncChange(FROM_HERE,
69 syncer::SyncChange::ACTION_ADD,
70 sync_data);
67 } 71 }
68 } 72 }
69 73
70 syncer::SyncDataList AppSyncBundle::GetAllSyncData() const { 74 syncer::SyncDataList AppSyncBundle::GetAllSyncData() const {
71 std::vector<AppSyncData> app_sync_data = 75 std::vector<AppSyncData> app_sync_data =
72 extension_service_->GetAppSyncDataList(); 76 extension_service_->GetAppSyncDataList();
73 syncer::SyncDataList result(app_sync_data.size()); 77 syncer::SyncDataList result(app_sync_data.size());
74 for (int i = 0; i < static_cast<int>(app_sync_data.size()); ++i) { 78 for (int i = 0; i < static_cast<int>(app_sync_data.size()); ++i) {
75 result[i] = app_sync_data[i].GetSyncData(); 79 result[i] = app_sync_data[i].GetSyncData();
76 } 80 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 161 }
158 162
159 163
160 void AppSyncBundle::MarkPendingAppSynced(const std::string& id) { 164 void AppSyncBundle::MarkPendingAppSynced(const std::string& id) {
161 pending_sync_data_.erase(id); 165 pending_sync_data_.erase(id);
162 synced_apps_.insert(id); 166 synced_apps_.insert(id);
163 } 167 }
164 168
165 169
166 } // namespace extensions 170 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/app_notification_manager_sync_unittest.cc ('k') | chrome/browser/extensions/app_sync_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698