thumbnail_service_impl.h revision 868fa2fe829687343ffae624259930155e16dbd8
1// Copyright (c) 2012 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#ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_
6#define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_
7
8#include "base/memory/ref_counted.h"
9#include "chrome/browser/history/top_sites.h"
10#include "chrome/browser/profiles/profile.h"
11#include "chrome/browser/thumbnails/thumbnail_service.h"
12
13namespace base {
14class RefCountedMemory;
15}
16
17namespace thumbnails {
18
19// An implementation of ThumbnailService which delegates storage and most of
20// logic to an underlying TopSites instances.
21class ThumbnailServiceImpl : public ThumbnailService {
22 public:
23  explicit ThumbnailServiceImpl(Profile* profile);
24
25  // Implementation of ThumbnailService.
26  virtual bool SetPageThumbnail(const ThumbnailingContext& context,
27                                const gfx::Image& thumbnail) OVERRIDE;
28  virtual ThumbnailingAlgorithm* GetThumbnailingAlgorithm() const OVERRIDE;
29  virtual bool GetPageThumbnail(
30      const GURL& url,
31      scoped_refptr<base::RefCountedMemory>* bytes) OVERRIDE;
32  virtual bool ShouldAcquirePageThumbnail(const GURL& url) OVERRIDE;
33
34  // Implementation of RefcountedBrowserContextKeyedService.
35  virtual void ShutdownOnUIThread() OVERRIDE;
36
37 private:
38  virtual ~ThumbnailServiceImpl();
39
40  scoped_refptr<history::TopSites> top_sites_;
41  bool use_thumbnail_retargeting_;
42
43  DISALLOW_COPY_AND_ASSIGN(ThumbnailServiceImpl);
44};
45
46}
47
48#endif  // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_
49