summaryrefslogtreecommitdiffstats
path: root/chrome/browser/thumbnails/thumbnail_service_impl.h
blob: 537bf0e366dce847aa7597e15bdb949b347a640f (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
44
45
46
47
48
49
50
// Copyright (c) 2012 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 CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_
#define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_

#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/thumbnails/thumbnail_service.h"
#include "components/history/core/browser/top_sites.h"

namespace base {
class RefCountedMemory;
}

namespace thumbnails {

// An implementation of ThumbnailService which delegates storage and most of
// logic to an underlying TopSites instances.
class ThumbnailServiceImpl : public ThumbnailService {
 public:
  explicit ThumbnailServiceImpl(Profile* profile);

  // Implementation of ThumbnailService.
  bool SetPageThumbnail(const ThumbnailingContext& context,
                        const gfx::Image& thumbnail) override;
  ThumbnailingAlgorithm* GetThumbnailingAlgorithm() const override;
  bool GetPageThumbnail(const GURL& url,
                        bool prefix_match,
                        scoped_refptr<base::RefCountedMemory>* bytes) override;
  void AddForcedURL(const GURL& url) override;
  bool ShouldAcquirePageThumbnail(const GURL& url) override;

  // Implementation of RefcountedKeyedService.
  void ShutdownOnUIThread() override;

 private:
  ~ThumbnailServiceImpl() override;

  scoped_refptr<history::TopSites> top_sites_;
  bool use_thumbnail_retargeting_;

  DISALLOW_COPY_AND_ASSIGN(ThumbnailServiceImpl);
};

}  // namespace thumbnails

#endif  // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_