summaryrefslogtreecommitdiff
path: root/chromium/components/offline_pages/core/model/store_thumbnail_task.h
blob: a0ce7cbc62f66c9fabfbad521f19e3a966518a88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2018 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.

#ifndef COMPONENTS_OFFLINE_PAGES_CORE_MODEL_STORE_THUMBNAIL_TASK_H_
#define COMPONENTS_OFFLINE_PAGES_CORE_MODEL_STORE_THUMBNAIL_TASK_H_

#include <vector>

#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "components/offline_pages/core/offline_page_thumbnail.h"
#include "components/offline_pages/core/task.h"

namespace offline_pages {
class OfflinePageMetadataStoreSQL;

// StoreThumbnailTask stores a thumbnail in the page_thumbnails table.
class StoreThumbnailTask : public Task {
 public:
  typedef base::OnceCallback<void(bool)> CompleteCallback;

  StoreThumbnailTask(OfflinePageMetadataStoreSQL* store,
                     OfflinePageThumbnail thumbnail,
                     CompleteCallback complete_callback);
  ~StoreThumbnailTask() override;

  // Task implementation:
  void Run() override;

 private:
  void Complete(bool success);

  OfflinePageMetadataStoreSQL* store_;
  OfflinePageThumbnail thumbnail_;
  CompleteCallback complete_callback_;
  base::WeakPtrFactory<StoreThumbnailTask> weak_ptr_factory_;
  DISALLOW_COPY_AND_ASSIGN(StoreThumbnailTask);
};

}  // namespace offline_pages

#endif  // COMPONENTS_OFFLINE_PAGES_CORE_MODEL_STORE_THUMBNAIL_TASK_H_