Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: chrome/browser/thumbnails/thumbnail_service.h

Issue 11985003: Refactored-out the code of thumbnaling algorithm from thumbnail_tab_helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated a comment. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/profiles/refcounted_profile_keyed_service.h" 8 #include "chrome/browser/profiles/refcounted_profile_keyed_service.h"
9 #include "chrome/common/thumbnail_score.h" 9 #include "chrome/common/thumbnail_score.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 #include "ui/gfx/image/image.h" 11 #include "ui/gfx/image/image.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 class ThumbnailingAlgorithm;
20 struct ThumbnailingContext;
21
19 // An interface abstracting access to thumbnails. Intended as a temporary 22 // An interface abstracting access to thumbnails. Intended as a temporary
20 // bridge facilitating switch from TopSites as the thumbnail source to a more 23 // bridge facilitating switch from TopSites as the thumbnail source to a more
21 // robust way of handling these artefacts. 24 // robust way of handling these artefacts.
22 class ThumbnailService : public RefcountedProfileKeyedService { 25 class ThumbnailService : public RefcountedProfileKeyedService {
23 public: 26 public:
24 // Sets the given thumbnail for the given URL. Returns true if the thumbnail 27 // Sets the given thumbnail for the given URL. Returns true if the thumbnail
25 // was updated. False means either the URL wasn't known to us, or we felt 28 // was updated. False means either the URL wasn't known to us, or we felt
26 // that our current thumbnail was superior to the given one. 29 // that our current thumbnail was superior to the given one.
27 virtual bool SetPageThumbnail(const GURL& url, 30 virtual bool SetPageThumbnail(const ThumbnailingContext& context,
28 const gfx::Image& thumbnail, 31 const gfx::Image& thumbnail) = 0;
29 const ThumbnailScore& score) = 0; 32
33 // Create and return a new instance of the algorithm. They encapsulate the
sky 2013/01/22 16:10:28 This is still implying ThumbnailingAlgorithm is so
motek. 2013/01/22 16:56:19 Done.
34 // process of creating a thumbnail from tab contents. The lifetime of these
35 // instances is limited to the act of processing a single tab image. They
36 // are permitted to hold the state of such process.
37 virtual ThumbnailingAlgorithm* CreateThumbnailingAlgorithm() const = 0;
30 38
31 // Gets a thumbnail for a given page. Returns true iff we have the thumbnail. 39 // Gets a thumbnail for a given page. Returns true iff we have the thumbnail.
32 // This may be invoked on any thread. 40 // This may be invoked on any thread.
33 // As this method may be invoked on any thread the ref count needs to be 41 // As this method may be invoked on any thread the ref count needs to be
34 // incremented before this method returns, so this takes a scoped_refptr*. 42 // incremented before this method returns, so this takes a scoped_refptr*.
35 virtual bool GetPageThumbnail( 43 virtual bool GetPageThumbnail(
36 const GURL& url, 44 const GURL& url,
37 scoped_refptr<base::RefCountedMemory>* bytes) = 0; 45 scoped_refptr<base::RefCountedMemory>* bytes) = 0;
38 46
39 // Returns true if the page thumbnail should be updated. 47 // Returns true if the page thumbnail should be updated.
40 virtual bool ShouldAcquirePageThumbnail(const GURL& url) = 0; 48 virtual bool ShouldAcquirePageThumbnail(const GURL& url) = 0;
41 49
42 protected: 50 protected:
43 virtual ~ThumbnailService() {} 51 virtual ~ThumbnailService() {}
44 }; 52 };
45 53
46 } 54 }
47 55
48 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_H_ 56 #endif // CHROME_BROWSER_THUMBNAILS_THUMBNAIL_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698