| 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_H_ | 5 #ifndef CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_H_ |
| 6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_H_ | 6 #define CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_H_ |
| 7 | 7 |
| 8 #include "chrome/common/thumbnail_score.h" | 8 #include "chrome/common/thumbnail_score.h" |
| 9 #include "components/browser_context_keyed_service/refcounted_browser_context_ke
yed_service.h" | 9 #include "components/browser_context_keyed_service/refcounted_browser_context_ke
yed_service.h" |
| 10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
| 11 #include "url/gurl.h" | 11 |
| 12 class GURL; |
| 12 | 13 |
| 13 namespace base { | 14 namespace base { |
| 14 class RefCountedMemory; | 15 class RefCountedMemory; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace thumbnails { | 18 namespace thumbnails { |
| 18 | 19 |
| 19 class ThumbnailingAlgorithm; | 20 class ThumbnailingAlgorithm; |
| 20 struct ThumbnailingContext; | 21 struct ThumbnailingContext; |
| 21 | 22 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 33 // Returns the ThumbnailingAlgorithm used for processing thumbnails. | 34 // Returns the ThumbnailingAlgorithm used for processing thumbnails. |
| 34 // It is always a new instance, the caller owns it. It will encapsulate the | 35 // It is always a new instance, the caller owns it. It will encapsulate the |
| 35 // process of creating a thumbnail from tab contents. The lifetime of these | 36 // process of creating a thumbnail from tab contents. The lifetime of these |
| 36 // instances is limited to the act of processing a single tab image. They | 37 // instances is limited to the act of processing a single tab image. They |
| 37 // are permitted to hold the state of such process. | 38 // are permitted to hold the state of such process. |
| 38 virtual ThumbnailingAlgorithm* GetThumbnailingAlgorithm() const = 0; | 39 virtual ThumbnailingAlgorithm* GetThumbnailingAlgorithm() const = 0; |
| 39 | 40 |
| 40 // Gets a thumbnail for a given page. Returns true iff we have the thumbnail. | 41 // Gets a thumbnail for a given page. Returns true iff we have the thumbnail. |
| 41 // This may be invoked on any thread. | 42 // This may be invoked on any thread. |
| 42 // If an exact thumbnail URL match fails, |prefix_match| specifies whether or | 43 // If an exact thumbnail URL match fails, |prefix_match| specifies whether or |
| 43 // not to try harder by matching the query thumbnail URL as URL prefix. | 44 // not to try harder by matching the query thumbnail URL as URL prefix (as |
| 45 // defined by UrlIsPrefix()). |
| 44 // As this method may be invoked on any thread the ref count needs to be | 46 // As this method may be invoked on any thread the ref count needs to be |
| 45 // incremented before this method returns, so this takes a scoped_refptr*. | 47 // incremented before this method returns, so this takes a scoped_refptr*. |
| 46 virtual bool GetPageThumbnail( | 48 virtual bool GetPageThumbnail( |
| 47 const GURL& url, | 49 const GURL& url, |
| 48 bool prefix_match, | 50 bool prefix_match, |
| 49 scoped_refptr<base::RefCountedMemory>* bytes) = 0; | 51 scoped_refptr<base::RefCountedMemory>* bytes) = 0; |
| 50 | 52 |
| 51 // Returns true if the page thumbnail should be updated. | 53 // Returns true if the page thumbnail should be updated. |
| 52 virtual bool ShouldAcquirePageThumbnail(const GURL& url) = 0; | 54 virtual bool ShouldAcquirePageThumbnail(const GURL& url) = 0; |
| 53 | 55 |
| 54 protected: | 56 protected: |
| 55 virtual ~ThumbnailService() {} | 57 virtual ~ThumbnailService() {} |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 } // namespace thumbnails | 60 } // namespace thumbnails |
| 59 | 61 |
| 60 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_H_ | 62 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_H_ |
| OLD | NEW |