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

Unified Diff: components/offline_pages/background/remove_requests_task.cc

Issue 2489443002: Move all components/offline_pages/ files into component/offline_pages/core (Closed)
Patch Set: rebase Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/background/remove_requests_task.cc
diff --git a/components/offline_pages/background/remove_requests_task.cc b/components/offline_pages/background/remove_requests_task.cc
deleted file mode 100644
index 15d45fe6acf0d79125206e066699b064b1109df6..0000000000000000000000000000000000000000
--- a/components/offline_pages/background/remove_requests_task.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/offline_pages/background/remove_requests_task.h"
-
-#include "base/bind.h"
-
-namespace offline_pages {
-
-RemoveRequestsTask::RemoveRequestsTask(
- RequestQueueStore* store,
- const std::vector<int64_t>& request_ids,
- const RequestQueueStore::UpdateCallback& callback)
- : store_(store),
- request_ids_(request_ids),
- callback_(callback),
- weak_ptr_factory_(this) {}
-
-RemoveRequestsTask::~RemoveRequestsTask() {}
-
-void RemoveRequestsTask::Run() {
- RemoveRequests();
-}
-
-void RemoveRequestsTask::RemoveRequests() {
- if (request_ids_.empty()) {
- CompleteEarly(ItemActionStatus::NOT_FOUND);
- return;
- }
-
- store_->RemoveRequests(request_ids_,
- base::Bind(&RemoveRequestsTask::CompleteWithResult,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
-void RemoveRequestsTask::CompleteEarly(ItemActionStatus status) {
- // TODO(fgorski): store_->state() once implemented
- std::unique_ptr<UpdateRequestsResult> result(
- new UpdateRequestsResult(StoreState::LOADED));
- for (int64_t request_id : request_ids_)
- result->item_statuses.push_back(std::make_pair(request_id, status));
- CompleteWithResult(std::move(result));
-}
-
-void RemoveRequestsTask::CompleteWithResult(
- std::unique_ptr<UpdateRequestsResult> result) {
- callback_.Run(std::move(result));
- TaskComplete();
-}
-
-} // namespace offline_pages

Powered by Google App Engine
This is Rietveld 408576698