OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/update_client/update_client.h" | 5 #include "components/update_client/update_client.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <queue> | 8 #include <queue> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // task runner yet. | 227 // task runner yet. |
228 while (!task_queue_.empty()) { | 228 while (!task_queue_.empty()) { |
229 auto* task(task_queue_.front()); | 229 auto* task(task_queue_.front()); |
230 task_queue_.pop(); | 230 task_queue_.pop(); |
231 task->Cancel(); | 231 task->Cancel(); |
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 void UpdateClientImpl::SendUninstallPing(const std::string& id, | 235 void UpdateClientImpl::SendUninstallPing(const std::string& id, |
236 const base::Version& version, | 236 const base::Version& version, |
237 int reason) { | 237 int reason, |
| 238 const Callback& callback) { |
238 DCHECK(thread_checker_.CalledOnValidThread()); | 239 DCHECK(thread_checker_.CalledOnValidThread()); |
239 | 240 |
240 // The implementation of PingManager::SendPing contains a self-deleting | 241 // The implementation of PingManager::SendPing contains a self-deleting |
241 // object responsible for sending the ping. | 242 // object responsible for sending the ping. |
242 CrxUpdateItem item; | 243 CrxUpdateItem item; |
243 item.state = CrxUpdateItem::State::kUninstalled; | 244 item.state = CrxUpdateItem::State::kUninstalled; |
244 item.id = id; | 245 item.id = id; |
245 item.previous_version = version; | 246 item.previous_version = version; |
246 item.next_version = base::Version("0"); | 247 item.next_version = base::Version("0"); |
247 item.extra_code1 = reason; | 248 item.extra_code1 = reason; |
248 | 249 |
249 ping_manager_->SendPing(&item); | 250 ping_manager_->SendPing(&item); |
| 251 |
| 252 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 253 FROM_HERE, base::Bind(callback, Error::NONE)); |
250 } | 254 } |
251 | 255 |
252 scoped_refptr<UpdateClient> UpdateClientFactory( | 256 scoped_refptr<UpdateClient> UpdateClientFactory( |
253 const scoped_refptr<Configurator>& config) { | 257 const scoped_refptr<Configurator>& config) { |
254 std::unique_ptr<PingManager> ping_manager(new PingManager(config)); | 258 std::unique_ptr<PingManager> ping_manager(new PingManager(config)); |
255 return new UpdateClientImpl(config, std::move(ping_manager), | 259 return new UpdateClientImpl(config, std::move(ping_manager), |
256 &UpdateChecker::Create, &CrxDownloader::Create); | 260 &UpdateChecker::Create, &CrxDownloader::Create); |
257 } | 261 } |
258 | 262 |
259 void RegisterPrefs(PrefRegistrySimple* registry) { | 263 void RegisterPrefs(PrefRegistrySimple* registry) { |
260 PersistedData::RegisterPrefs(registry); | 264 PersistedData::RegisterPrefs(registry); |
261 } | 265 } |
262 | 266 |
263 } // namespace update_client | 267 } // namespace update_client |
OLD | NEW |