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/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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 void AppSyncBundle::AddPendingApp(const std::string& id, | 113 void AppSyncBundle::AddPendingApp(const std::string& id, |
114 const AppSyncData& app_sync_data) { | 114 const AppSyncData& app_sync_data) { |
115 pending_sync_data_[id] = app_sync_data; | 115 pending_sync_data_[id] = app_sync_data; |
116 } | 116 } |
117 | 117 |
118 bool AppSyncBundle::IsSyncing() const { | 118 bool AppSyncBundle::IsSyncing() const { |
119 return sync_processor_ != NULL; | 119 return sync_processor_ != NULL; |
120 } | 120 } |
121 | 121 |
122 void AppSyncBundle::SyncChangeIfNeeded(const Extension& extension) { | 122 void AppSyncBundle::SyncChangeIfNeeded(const Extension& extension) { |
123 // If there is a pending update for this app, apply it first. | |
124 auto it = pending_sync_data_.find(extension.id()); | |
125 if (it != pending_sync_data_.end()) | |
126 ProcessSyncChange(it->second); | |
Marc Treib
2015/06/22 15:35:18
Before this CL, the pending_sync_data_ was applied
not at google - send to devlin
2015/06/22 21:03:10
I'm struggling with this. Is SyncChangeIfNeeded th
Marc Treib
2015/06/23 10:22:25
My reasoning is this: At some previous point, we d
not at google - send to devlin
2015/06/24 00:25:10
That doesn't sound like it follows to me. Perhaps
Marc Treib
2015/06/24 11:50:57
Well, in the current state, ProcessExtensionSyncDa
not at google - send to devlin
2015/06/24 20:47:38
Indeed. It wouldn't be too hard of a transformatio
Marc Treib
2015/06/29 09:52:49
I'll take a shot at it. Let's see where I'll end u
| |
127 | |
123 AppSyncData app_sync_data = extension_sync_service_->GetAppSyncData( | 128 AppSyncData app_sync_data = extension_sync_service_->GetAppSyncData( |
124 extension); | 129 extension); |
125 | 130 |
126 syncer::SyncChangeList sync_change_list(1, app_sync_data.GetSyncChange( | 131 syncer::SyncChangeList sync_change_list(1, app_sync_data.GetSyncChange( |
127 HasExtensionId(extension.id()) ? | 132 HasExtensionId(extension.id()) ? |
128 syncer::SyncChange::ACTION_UPDATE : syncer::SyncChange::ACTION_ADD)); | 133 syncer::SyncChange::ACTION_UPDATE : syncer::SyncChange::ACTION_ADD)); |
129 sync_processor_->ProcessSyncChanges(FROM_HERE, sync_change_list); | 134 sync_processor_->ProcessSyncChanges(FROM_HERE, sync_change_list); |
130 MarkPendingAppSynced(extension.id()); | 135 MarkPendingAppSynced(extension.id()); |
131 } | 136 } |
132 | 137 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 } | 175 } |
171 | 176 |
172 | 177 |
173 void AppSyncBundle::MarkPendingAppSynced(const std::string& id) { | 178 void AppSyncBundle::MarkPendingAppSynced(const std::string& id) { |
174 pending_sync_data_.erase(id); | 179 pending_sync_data_.erase(id); |
175 synced_apps_.insert(id); | 180 synced_apps_.insert(id); |
176 } | 181 } |
177 | 182 |
178 | 183 |
179 } // namespace extensions | 184 } // namespace extensions |
OLD | NEW |