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

Side by Side Diff: components/offline_pages/core/background/remove_requests_task.cc

Issue 2841113003: [Offline pages] Addressing TODOs in RemoveRequestTask (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « components/offline_pages/core/background/remove_requests_task.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/core/background/remove_requests_task.h" 5 #include "components/offline_pages/core/background/remove_requests_task.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 8
9 namespace offline_pages { 9 namespace offline_pages {
10 10
(...skipping 17 matching lines...) Expand all
28 CompleteEarly(ItemActionStatus::NOT_FOUND); 28 CompleteEarly(ItemActionStatus::NOT_FOUND);
29 return; 29 return;
30 } 30 }
31 31
32 store_->RemoveRequests(request_ids_, 32 store_->RemoveRequests(request_ids_,
33 base::Bind(&RemoveRequestsTask::CompleteWithResult, 33 base::Bind(&RemoveRequestsTask::CompleteWithResult,
34 weak_ptr_factory_.GetWeakPtr())); 34 weak_ptr_factory_.GetWeakPtr()));
35 } 35 }
36 36
37 void RemoveRequestsTask::CompleteEarly(ItemActionStatus status) { 37 void RemoveRequestsTask::CompleteEarly(ItemActionStatus status) {
38 // TODO(fgorski): store_->state() once implemented
39 std::unique_ptr<UpdateRequestsResult> result( 38 std::unique_ptr<UpdateRequestsResult> result(
40 new UpdateRequestsResult(StoreState::LOADED)); 39 new UpdateRequestsResult(store_->state()));
41 for (int64_t request_id : request_ids_) 40 for (int64_t request_id : request_ids_)
42 result->item_statuses.push_back(std::make_pair(request_id, status)); 41 result->item_statuses.push_back(std::make_pair(request_id, status));
43 CompleteWithResult(std::move(result)); 42 CompleteWithResult(std::move(result));
44 } 43 }
45 44
46 void RemoveRequestsTask::CompleteWithResult( 45 void RemoveRequestsTask::CompleteWithResult(
47 std::unique_ptr<UpdateRequestsResult> result) { 46 std::unique_ptr<UpdateRequestsResult> result) {
48 callback_.Run(std::move(result)); 47 callback_.Run(std::move(result));
49 TaskComplete(); 48 TaskComplete();
50 } 49 }
51 50
52 } // namespace offline_pages 51 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/core/background/remove_requests_task.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698