OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_IMAGE_SERVICE_H_ | 4 #ifndef COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_IMAGE_SERVICE_H_ |
5 #define COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_IMAGE_SERVICE_H_ | 5 #define COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_IMAGE_SERVICE_H_ |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "components/bookmarks/browser/bookmark_model_observer.h" | 10 #include "components/bookmarks/browser/bookmark_model_observer.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 EnhancedBookmarkModel* enhanced_bookmark_model, | 31 EnhancedBookmarkModel* enhanced_bookmark_model, |
32 scoped_refptr<base::SequencedWorkerPool> pool); | 32 scoped_refptr<base::SequencedWorkerPool> pool); |
33 BookmarkImageService(scoped_ptr<ImageStore> store, | 33 BookmarkImageService(scoped_ptr<ImageStore> store, |
34 EnhancedBookmarkModel* enhanced_bookmark_model, | 34 EnhancedBookmarkModel* enhanced_bookmark_model, |
35 scoped_refptr<base::SequencedWorkerPool> pool); | 35 scoped_refptr<base::SequencedWorkerPool> pool); |
36 | 36 |
37 virtual ~BookmarkImageService(); | 37 virtual ~BookmarkImageService(); |
38 | 38 |
39 typedef base::Callback<void(const gfx::Image&, const GURL& url)> Callback; | 39 typedef base::Callback<void(const gfx::Image&, const GURL& url)> Callback; |
40 | 40 |
| 41 // KeyedService: |
| 42 virtual void Shutdown() OVERRIDE; |
| 43 |
41 // Returns a salient image for a URL. This may trigger a network request for | 44 // Returns a salient image for a URL. This may trigger a network request for |
42 // the image if the image was not retrieved before and if a bookmark node has | 45 // the image if the image was not retrieved before and if a bookmark node has |
43 // a URL for this salient image available. The image (which may be empty) is | 46 // a URL for this salient image available. The image (which may be empty) is |
44 // sent via the callback. The callback may be called synchronously if it is | 47 // sent via the callback. The callback may be called synchronously if it is |
45 // possible. The callback is always triggered on the main thread. | 48 // possible. The callback is always triggered on the main thread. |
46 void SalientImageForUrl(const GURL& page_url, Callback callback); | 49 void SalientImageForUrl(const GURL& page_url, Callback callback); |
47 | 50 |
48 // BookmarkModelObserver methods. | 51 // BookmarkModelObserver methods. |
49 virtual void BookmarkNodeRemoved(BookmarkModel* model, | 52 virtual void BookmarkNodeRemoved(BookmarkModel* model, |
50 const BookmarkNode* parent, | 53 const BookmarkNode* parent, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 GURL previous_url_; | 163 GURL previous_url_; |
161 | 164 |
162 // The worker pool to enqueue the store requests onto. | 165 // The worker pool to enqueue the store requests onto. |
163 scoped_refptr<base::SequencedWorkerPool> pool_; | 166 scoped_refptr<base::SequencedWorkerPool> pool_; |
164 DISALLOW_COPY_AND_ASSIGN(BookmarkImageService); | 167 DISALLOW_COPY_AND_ASSIGN(BookmarkImageService); |
165 }; | 168 }; |
166 | 169 |
167 } // namespace enhanced_bookmarks | 170 } // namespace enhanced_bookmarks |
168 | 171 |
169 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_IMAGE_SERVICE_H_ | 172 #endif // COMPONENTS_ENHANCED_BOOKMARKS_BOOKMARK_IMAGE_SERVICE_H_ |
OLD | NEW |