| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/offline_pages/background/get_requests_task.h" |
| 6 |
| 7 #include <vector> |
| 8 |
| 9 #include "base/bind.h" |
| 10 |
| 11 namespace offline_pages { |
| 12 |
| 13 GetRequestsTask::GetRequestsTask( |
| 14 RequestQueueStore* store, |
| 15 const RequestQueueStore::GetRequestsCallback& callback) |
| 16 : store_(store), callback_(callback), weak_ptr_factory_(this) {} |
| 17 |
| 18 GetRequestsTask::~GetRequestsTask() {} |
| 19 |
| 20 void GetRequestsTask::Run() { |
| 21 ReadRequest(); |
| 22 } |
| 23 |
| 24 void GetRequestsTask::ReadRequest() { |
| 25 store_->GetRequests(base::Bind(&GetRequestsTask::CompleteWithResult, |
| 26 weak_ptr_factory_.GetWeakPtr())); |
| 27 } |
| 28 |
| 29 void GetRequestsTask::CompleteWithResult( |
| 30 bool success, |
| 31 std::vector<std::unique_ptr<SavePageRequest>> requests) { |
| 32 callback_.Run(success, std::move(requests)); |
| 33 TaskComplete(); |
| 34 } |
| 35 |
| 36 } // namespace offline_pages |
| OLD | NEW |