closure_task.h 737 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2018 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. #ifndef COMPONENTS_OFFLINE_PAGES_TASK_CLOSURE_TASK_H_
  5. #define COMPONENTS_OFFLINE_PAGES_TASK_CLOSURE_TASK_H_
  6. #include "base/callback.h"
  7. #include "components/offline_pages/task/task.h"
  8. namespace offline_pages {
  9. // Implements |Task| by calling a closure on |Run()|, and then calling
  10. // TaskComplete().
  11. class ClosureTask : public Task {
  12. public:
  13. ClosureTask(base::OnceClosure closure);
  14. ~ClosureTask() override;
  15. private:
  16. void Run() override;
  17. base::OnceClosure closure_;
  18. };
  19. } // namespace offline_pages
  20. #endif // COMPONENTS_OFFLINE_PAGES_TASK_CLOSURE_TASK_H_