OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_IMPL_H_ | 5 #ifndef COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_IMPL_H_ |
6 #define COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_IMPL_H_ | 6 #define COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // Public for testing. | 46 // Public for testing. |
47 void DidDownloadFavicon(int id, | 47 void DidDownloadFavicon(int id, |
48 int http_status_code, | 48 int http_status_code, |
49 const GURL& image_url, | 49 const GURL& image_url, |
50 const std::vector<SkBitmap>& bitmaps, | 50 const std::vector<SkBitmap>& bitmaps, |
51 const std::vector<gfx::Size>& original_bitmap_sizes); | 51 const std::vector<gfx::Size>& original_bitmap_sizes); |
52 | 52 |
53 // FaviconDriver implementation. | 53 // FaviconDriver implementation. |
54 void FetchFavicon(const GURL& url) override; | 54 void FetchFavicon(const GURL& url) override; |
55 bool IsBookmarked(const GURL& url) override; | 55 bool IsBookmarked(const GURL& url) override; |
56 void OnFaviconAvailable(const gfx::Image& image, | 56 void OnFaviconAvailable(const GURL& page_url, |
57 const GURL& icon_url, | 57 const GURL& icon_url, |
| 58 const gfx::Image& image, |
58 bool is_active_favicon) override; | 59 bool is_active_favicon) override; |
59 bool HasPendingTasksForTest() override; | 60 bool HasPendingTasksForTest() override; |
60 | 61 |
61 protected: | 62 protected: |
62 FaviconDriverImpl(FaviconService* favicon_service, | 63 FaviconDriverImpl(FaviconService* favicon_service, |
63 history::HistoryService* history_service, | 64 history::HistoryService* history_service, |
64 bookmarks::BookmarkModel* bookmark_model); | 65 bookmarks::BookmarkModel* bookmark_model); |
65 ~FaviconDriverImpl() override; | 66 ~FaviconDriverImpl() override; |
66 | 67 |
67 // Returns whether downloading favicon for |url| previously failed. | 68 // Returns whether downloading favicon for |url| previously failed. |
68 bool WasUnableToDownloadFavicon(const GURL& url); | 69 bool WasUnableToDownloadFavicon(const GURL& url); |
69 | 70 |
70 // Informs FaviconService that the favicon for |url| is out of date. If | 71 // Informs FaviconService that the favicon for |url| is out of date. If |
71 // |force_reload| is true, then discard information about favicon download | 72 // |force_reload| is true, then discard information about favicon download |
72 // failures. | 73 // failures. |
73 void SetFaviconOutOfDateForPage(const GURL& url, bool force_reload); | 74 void SetFaviconOutOfDateForPage(const GURL& url, bool force_reload); |
74 | 75 |
75 // Broadcasts new favicon URL candidates to FaviconHandlers. | 76 // Broadcasts new favicon URL candidates to FaviconHandlers. |
76 void OnUpdateFaviconURL(const std::vector<FaviconURL>& candidates); | 77 void OnUpdateFaviconURL(const GURL& page_url, |
| 78 const std::vector<FaviconURL>& candidates); |
77 | 79 |
78 protected: | 80 protected: |
79 history::HistoryService* history_service() { return history_service_; } | 81 history::HistoryService* history_service() { return history_service_; } |
80 | 82 |
81 FaviconService* favicon_service() { return favicon_service_; } | 83 FaviconService* favicon_service() { return favicon_service_; } |
82 | 84 |
83 private: | 85 private: |
84 // KeyedServices used by FaviconDriverImpl. They may be null during testing, | 86 // KeyedServices used by FaviconDriverImpl. They may be null during testing, |
85 // but if they are defined, they must outlive the FaviconDriverImpl. | 87 // but if they are defined, they must outlive the FaviconDriverImpl. |
86 FaviconService* favicon_service_; | 88 FaviconService* favicon_service_; |
87 history::HistoryService* history_service_; | 89 history::HistoryService* history_service_; |
88 bookmarks::BookmarkModel* bookmark_model_; | 90 bookmarks::BookmarkModel* bookmark_model_; |
89 | 91 |
90 // FaviconHandlers used to download the different kind of favicons. Both | 92 // FaviconHandlers used to download the different kind of favicons. Both |
91 // |touch_icon_handler_| and |large_icon_handler_| may be null depending | 93 // |touch_icon_handler_| and |large_icon_handler_| may be null depending |
92 // on the platform or variations. | 94 // on the platform or variations. |
93 scoped_ptr<FaviconHandler> favicon_handler_; | 95 scoped_ptr<FaviconHandler> favicon_handler_; |
94 scoped_ptr<FaviconHandler> touch_icon_handler_; | 96 scoped_ptr<FaviconHandler> touch_icon_handler_; |
95 scoped_ptr<FaviconHandler> large_icon_handler_; | 97 scoped_ptr<FaviconHandler> large_icon_handler_; |
96 | 98 |
97 DISALLOW_COPY_AND_ASSIGN(FaviconDriverImpl); | 99 DISALLOW_COPY_AND_ASSIGN(FaviconDriverImpl); |
98 }; | 100 }; |
99 | 101 |
100 } // namespace favicon | 102 } // namespace favicon |
101 | 103 |
102 #endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_IMPL_H_ | 104 #endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_IMPL_H_ |
OLD | NEW |