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_FAVICON_FAVICON_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ |
6 #define CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ | 6 #define CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/task/cancelable_task_tracker.h" | 13 #include "base/task/cancelable_task_tracker.h" |
14 #include "components/favicon_base/favicon_callback.h" | 14 #include "components/favicon_base/favicon_callback.h" |
15 #include "components/favicon_base/favicon_types.h" | 15 #include "components/favicon_base/favicon_types.h" |
16 #include "components/keyed_service/core/keyed_service.h" | 16 #include "components/keyed_service/core/keyed_service.h" |
17 #include "ui/base/layout.h" | 17 #include "ui/base/layout.h" |
18 | 18 |
19 class FaviconClient; | |
19 class GURL; | 20 class GURL; |
20 class HistoryService; | 21 class HistoryService; |
21 struct ImportedFaviconUsage; | 22 struct ImportedFaviconUsage; |
22 class Profile; | 23 class Profile; |
23 | 24 |
24 // The favicon service provides methods to access favicons. It calls the history | 25 // The favicon service provides methods to access favicons. It calls the history |
25 // backend behind the scenes. | 26 // backend behind the scenes. |
26 class FaviconService : public KeyedService { | 27 class FaviconService : public KeyedService { |
27 public: | 28 public: |
28 explicit FaviconService(Profile* profile); | 29 explicit FaviconService(Profile* profile, FaviconClient* favicon_client); |
blundell
2014/05/27 18:48:40
nit: get rid of explicit
blundell
2014/05/27 18:48:40
Add a comment on these parameters, including their
jif
2014/05/28 09:05:40
Done.
| |
29 | 30 |
30 virtual ~FaviconService(); | 31 virtual ~FaviconService(); |
31 | 32 |
32 // Auxiliary argument structure for requesting favicons for URLs. | 33 // Auxiliary argument structure for requesting favicons for URLs. |
33 struct FaviconForURLParams { | 34 struct FaviconForURLParams { |
34 FaviconForURLParams(const GURL& page_url, | 35 FaviconForURLParams(const GURL& page_url, |
35 int icon_types, | 36 int icon_types, |
36 int desired_size_in_dip) | 37 int desired_size_in_dip) |
37 : page_url(page_url), | 38 : page_url(page_url), |
38 icon_types(icon_types), | 39 icon_types(icon_types), |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 // Avoid repeated requests to download missing favicon. | 214 // Avoid repeated requests to download missing favicon. |
214 void UnableToDownloadFavicon(const GURL& icon_url); | 215 void UnableToDownloadFavicon(const GURL& icon_url); |
215 bool WasUnableToDownloadFavicon(const GURL& icon_url) const; | 216 bool WasUnableToDownloadFavicon(const GURL& icon_url) const; |
216 void ClearUnableToDownloadFavicons(); | 217 void ClearUnableToDownloadFavicons(); |
217 | 218 |
218 private: | 219 private: |
219 typedef uint32 MissingFaviconURLHash; | 220 typedef uint32 MissingFaviconURLHash; |
220 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_; | 221 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_; |
221 HistoryService* history_service_; | 222 HistoryService* history_service_; |
222 Profile* profile_; | 223 Profile* profile_; |
224 FaviconClient* favicon_client_; | |
223 | 225 |
224 // Helper function for GetFaviconImageForURL(), GetRawFaviconForURL() and | 226 // Helper function for GetFaviconImageForURL(), GetRawFaviconForURL() and |
225 // GetFaviconForURL(). | 227 // GetFaviconForURL(). |
226 base::CancelableTaskTracker::TaskId GetFaviconForURLImpl( | 228 base::CancelableTaskTracker::TaskId GetFaviconForURLImpl( |
227 const FaviconForURLParams& params, | 229 const FaviconForURLParams& params, |
228 const std::vector<ui::ScaleFactor>& desired_scale_factors, | 230 const std::vector<ui::ScaleFactor>& desired_scale_factors, |
229 const favicon_base::FaviconResultsCallback& callback, | 231 const favicon_base::FaviconResultsCallback& callback, |
230 base::CancelableTaskTracker* tracker); | 232 base::CancelableTaskTracker* tracker); |
231 | 233 |
232 // Intermediate callback for GetFaviconImage() and GetFaviconImageForURL() | 234 // Intermediate callback for GetFaviconImage() and GetFaviconImageForURL() |
(...skipping 14 matching lines...) Expand all Loading... | |
247 const favicon_base::FaviconRawCallback& callback, | 249 const favicon_base::FaviconRawCallback& callback, |
248 int desired_size_in_dip, | 250 int desired_size_in_dip, |
249 ui::ScaleFactor desired_scale_factor, | 251 ui::ScaleFactor desired_scale_factor, |
250 const std::vector<favicon_base::FaviconBitmapResult>& | 252 const std::vector<favicon_base::FaviconBitmapResult>& |
251 favicon_bitmap_results); | 253 favicon_bitmap_results); |
252 | 254 |
253 DISALLOW_COPY_AND_ASSIGN(FaviconService); | 255 DISALLOW_COPY_AND_ASSIGN(FaviconService); |
254 }; | 256 }; |
255 | 257 |
256 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ | 258 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ |
OLD | NEW |