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

Side by Side Diff: components/offline_pages/background/request_coordinator.cc

Issue 2197573003: Provide API in RequestCoordinator to remove results by client ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment changes per feedback Created 4 years, 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/offline_pages/background/request_coordinator.h" 5 #include "components/offline_pages/background/request_coordinator.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 offline_pages::SavePageRequest request( 63 offline_pages::SavePageRequest request(
64 id++, url, client_id, base::Time::Now(), was_user_requested); 64 id++, url, client_id, base::Time::Now(), was_user_requested);
65 65
66 // Put the request on the request queue. 66 // Put the request on the request queue.
67 queue_->AddRequest(request, 67 queue_->AddRequest(request,
68 base::Bind(&RequestCoordinator::AddRequestResultCallback, 68 base::Bind(&RequestCoordinator::AddRequestResultCallback,
69 weak_ptr_factory_.GetWeakPtr())); 69 weak_ptr_factory_.GetWeakPtr()));
70 return true; 70 return true;
71 } 71 }
72 72
73 void RequestCoordinator::RemoveRequests(
74 const std::vector<ClientId>& client_ids) {
75 queue_->RemoveRequestsByClientId(
76 client_ids, base::Bind(&RequestCoordinator::UpdateRequestCallback,
77 weak_ptr_factory_.GetWeakPtr()));
78 }
79
73 void RequestCoordinator::AddRequestResultCallback( 80 void RequestCoordinator::AddRequestResultCallback(
74 RequestQueue::AddRequestResult result, 81 RequestQueue::AddRequestResult result,
75 const SavePageRequest& request) { 82 const SavePageRequest& request) {
76 83
77 // Inform the scheduler that we have an outstanding task.. 84 // Inform the scheduler that we have an outstanding task..
78 scheduler_->Schedule(GetTriggerConditionsForUserRequest()); 85 scheduler_->Schedule(GetTriggerConditionsForUserRequest());
79 } 86 }
80 87
81 // Called in response to updating a request in the request queue. 88 // Called in response to updating a request in the request queue.
82 void RequestCoordinator::UpdateRequestCallback( 89 void RequestCoordinator::UpdateRequestCallback(
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 return trigger_conditions; 247 return trigger_conditions;
241 } 248 }
242 249
243 void RequestCoordinator::GetOffliner() { 250 void RequestCoordinator::GetOffliner() {
244 if (!offliner_) { 251 if (!offliner_) {
245 offliner_ = factory_->GetOffliner(policy_.get()); 252 offliner_ = factory_->GetOffliner(policy_.get());
246 } 253 }
247 } 254 }
248 255
249 } // namespace offline_pages 256 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/background/request_coordinator.h ('k') | components/offline_pages/background/request_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698