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

Side by Side Diff: components/update_client/update_client.cc

Issue 1578083002: Implements an UpdateClient::SendUninstallPing API for the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // Cancel the pending tasks. These tasks are safe to cancel and delete since 219 // Cancel the pending tasks. These tasks are safe to cancel and delete since
220 // they have not picked up by the update engine, and not shared with any 220 // they have not picked up by the update engine, and not shared with any
221 // task runner yet. 221 // task runner yet.
222 while (!task_queue_.empty()) { 222 while (!task_queue_.empty()) {
223 const auto task(task_queue_.front()); 223 const auto task(task_queue_.front());
224 task_queue_.pop(); 224 task_queue_.pop();
225 task->Cancel(); 225 task->Cancel();
226 } 226 }
227 } 227 }
228 228
229 void UpdateClientImpl::SendUninstallPing(const std::string& id,
230 const Version& version,
231 int reason) {
232 DCHECK(thread_checker_.CalledOnValidThread());
233
234 // The implementation of PingManager::SendPing contains a self-deleting
235 // object responsible for sending the ping.
236 CrxUpdateItem item;
237 item.state = CrxUpdateItem::State::kUninstalled;
238 item.id = id;
239 item.previous_version = version;
240 item.next_version = base::Version("0");
241 item.error_code = reason;
waffles 2016/01/12 02:26:38 I'm not sure about overloading error_code to be th
Sorin Jianu 2016/01/12 03:24:06 Done.
asargent_no_longer_on_chrome 2016/01/14 21:57:53 Just to confirm, yes, we do want to be able to sen
242
243 ping_manager_->SendPing(&item);
244 }
245
229 scoped_refptr<UpdateClient> UpdateClientFactory( 246 scoped_refptr<UpdateClient> UpdateClientFactory(
230 const scoped_refptr<Configurator>& config) { 247 const scoped_refptr<Configurator>& config) {
231 scoped_ptr<PingManager> ping_manager(new PingManager(config)); 248 scoped_ptr<PingManager> ping_manager(new PingManager(config));
232 return new UpdateClientImpl(config, std::move(ping_manager), 249 return new UpdateClientImpl(config, std::move(ping_manager),
233 &UpdateChecker::Create, &CrxDownloader::Create); 250 &UpdateChecker::Create, &CrxDownloader::Create);
234 } 251 }
235 252
236 } // namespace update_client 253 } // namespace update_client
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698