| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_ | 5 #ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_ |
| 6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_ | 6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "chrome/browser/history/top_sites.h" | 9 #include "chrome/browser/history/top_sites.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/thumbnails/thumbnail_service.h" | 11 #include "chrome/browser/thumbnails/thumbnail_service.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 class RefCountedMemory; | 14 class RefCountedMemory; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace thumbnails { | 17 namespace thumbnails { |
| 18 | 18 |
| 19 // An implementation of ThumbnailService which delegates storage and most of | 19 // An implementation of ThumbnailService which delegates storage and most of |
| 20 // logic to an underlying TopSites instances. | 20 // logic to an underlying TopSites instances. |
| 21 class ThumbnailServiceImpl : public ThumbnailService { | 21 class ThumbnailServiceImpl : public ThumbnailService { |
| 22 public: | 22 public: |
| 23 explicit ThumbnailServiceImpl(Profile* profile); | 23 explicit ThumbnailServiceImpl(Profile* profile); |
| 24 | 24 |
| 25 // Implementation of ThumbnailService. | 25 // Implementation of ThumbnailService. |
| 26 virtual bool SetPageThumbnail(const ThumbnailingContext& context, | 26 bool SetPageThumbnail(const ThumbnailingContext& context, |
| 27 const gfx::Image& thumbnail) override; | 27 const gfx::Image& thumbnail) override; |
| 28 virtual ThumbnailingAlgorithm* GetThumbnailingAlgorithm() const override; | 28 ThumbnailingAlgorithm* GetThumbnailingAlgorithm() const override; |
| 29 virtual bool GetPageThumbnail( | 29 bool GetPageThumbnail(const GURL& url, |
| 30 const GURL& url, | 30 bool prefix_match, |
| 31 bool prefix_match, | 31 scoped_refptr<base::RefCountedMemory>* bytes) override; |
| 32 scoped_refptr<base::RefCountedMemory>* bytes) override; | 32 void AddForcedURL(const GURL& url) override; |
| 33 virtual void AddForcedURL(const GURL& url) override; | 33 bool ShouldAcquirePageThumbnail(const GURL& url) override; |
| 34 virtual bool ShouldAcquirePageThumbnail(const GURL& url) override; | |
| 35 | 34 |
| 36 // Implementation of RefcountedKeyedService. | 35 // Implementation of RefcountedKeyedService. |
| 37 virtual void ShutdownOnUIThread() override; | 36 void ShutdownOnUIThread() override; |
| 38 | 37 |
| 39 private: | 38 private: |
| 40 virtual ~ThumbnailServiceImpl(); | 39 ~ThumbnailServiceImpl() override; |
| 41 | 40 |
| 42 scoped_refptr<history::TopSites> top_sites_; | 41 scoped_refptr<history::TopSites> top_sites_; |
| 43 bool use_thumbnail_retargeting_; | 42 bool use_thumbnail_retargeting_; |
| 44 | 43 |
| 45 DISALLOW_COPY_AND_ASSIGN(ThumbnailServiceImpl); | 44 DISALLOW_COPY_AND_ASSIGN(ThumbnailServiceImpl); |
| 46 }; | 45 }; |
| 47 | 46 |
| 48 } // namespace thumbnails | 47 } // namespace thumbnails |
| 49 | 48 |
| 50 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_ | 49 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_IMPL_H_ |
| OLD | NEW |