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.
5 #ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_
6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_
8 #include "base/memory/ref_counted.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/thumbnails/thumbnail_service.h"
11 #include "components/history/core/browser/top_sites.h"
14 class RefCountedMemory
;
17 namespace thumbnails
{
19 // An implementation of ThumbnailService which delegates storage and most of
20 // logic to an underlying TopSites instances.
21 class ThumbnailServiceImpl
: public ThumbnailService
{
23 explicit ThumbnailServiceImpl(Profile
* profile
);
25 // Implementation of ThumbnailService.
26 bool SetPageThumbnail(const ThumbnailingContext
& context
,
27 const gfx::Image
& thumbnail
) override
;
28 ThumbnailingAlgorithm
* GetThumbnailingAlgorithm() const override
;
29 bool GetPageThumbnail(const GURL
& url
,
31 scoped_refptr
<base::RefCountedMemory
>* bytes
) override
;
32 void AddForcedURL(const GURL
& url
) override
;
33 bool ShouldAcquirePageThumbnail(const GURL
& url
) override
;
35 // Implementation of RefcountedKeyedService.
36 void ShutdownOnUIThread() override
;
39 ~ThumbnailServiceImpl() override
;
41 scoped_refptr
<history::TopSites
> top_sites_
;
42 bool use_thumbnail_retargeting_
;
44 DISALLOW_COPY_AND_ASSIGN(ThumbnailServiceImpl
);
47 } // namespace thumbnails
49 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_