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

Side by Side Diff: chrome/browser/favicon/favicon_service.h

Issue 302433010: Pass an instance of FaviconClient to FaviconService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@latest2
Patch Set: Added include. Created 6 years, 5 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
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_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 17
18 class FaviconClient;
18 class GURL; 19 class GURL;
19 class HistoryService; 20 class HistoryService;
20 struct ImportedFaviconUsage; 21 struct ImportedFaviconUsage;
21 class Profile; 22 class Profile;
22 23
23 // The favicon service provides methods to access favicons. It calls the history 24 // The favicon service provides methods to access favicons. It calls the history
24 // backend behind the scenes. 25 // backend behind the scenes.
25 class FaviconService : public KeyedService { 26 class FaviconService : public KeyedService {
26 public: 27 public:
27 explicit FaviconService(Profile* profile); 28 // TODO(jif): Remove usage of Profile. http://crbug.com/378208.
29 // The FaviconClient must outlive the constructed FaviconService.
30 FaviconService(Profile* profile, FaviconClient* favicon_client);
28 31
29 virtual ~FaviconService(); 32 virtual ~FaviconService();
30 33
31 // Auxiliary argument structure for requesting favicons for URLs. 34 // Auxiliary argument structure for requesting favicons for URLs.
32 struct FaviconForPageURLParams { 35 struct FaviconForPageURLParams {
33 FaviconForPageURLParams(const GURL& page_url, 36 FaviconForPageURLParams(const GURL& page_url,
34 int icon_types, 37 int icon_types,
35 int desired_size_in_dip) 38 int desired_size_in_dip)
36 : page_url(page_url), 39 : page_url(page_url),
37 icon_types(icon_types), 40 icon_types(icon_types),
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Avoid repeated requests to download missing favicon. 215 // Avoid repeated requests to download missing favicon.
213 void UnableToDownloadFavicon(const GURL& icon_url); 216 void UnableToDownloadFavicon(const GURL& icon_url);
214 bool WasUnableToDownloadFavicon(const GURL& icon_url) const; 217 bool WasUnableToDownloadFavicon(const GURL& icon_url) const;
215 void ClearUnableToDownloadFavicons(); 218 void ClearUnableToDownloadFavicons();
216 219
217 private: 220 private:
218 typedef uint32 MissingFaviconURLHash; 221 typedef uint32 MissingFaviconURLHash;
219 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_; 222 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_;
220 HistoryService* history_service_; 223 HistoryService* history_service_;
221 Profile* profile_; 224 Profile* profile_;
225 FaviconClient* favicon_client_;
222 226
223 // Helper function for GetFaviconImageForPageURL(), GetRawFaviconForPageURL() 227 // Helper function for GetFaviconImageForPageURL(), GetRawFaviconForPageURL()
224 // and GetFaviconForPageURL(). 228 // and GetFaviconForPageURL().
225 base::CancelableTaskTracker::TaskId GetFaviconForPageURLImpl( 229 base::CancelableTaskTracker::TaskId GetFaviconForPageURLImpl(
226 const FaviconForPageURLParams& params, 230 const FaviconForPageURLParams& params,
227 const std::vector<int>& desired_sizes_in_pixel, 231 const std::vector<int>& desired_sizes_in_pixel,
228 const favicon_base::FaviconResultsCallback& callback, 232 const favicon_base::FaviconResultsCallback& callback,
229 base::CancelableTaskTracker* tracker); 233 base::CancelableTaskTracker* tracker);
230 234
231 // Intermediate callback for GetFaviconImage() and GetFaviconImageForPageURL() 235 // Intermediate callback for GetFaviconImage() and GetFaviconImageForPageURL()
(...skipping 13 matching lines...) Expand all
245 void RunFaviconRawBitmapCallbackWithBitmapResults( 249 void RunFaviconRawBitmapCallbackWithBitmapResults(
246 const favicon_base::FaviconRawBitmapCallback& callback, 250 const favicon_base::FaviconRawBitmapCallback& callback,
247 int desired_size_in_pixel, 251 int desired_size_in_pixel,
248 const std::vector<favicon_base::FaviconRawBitmapResult>& 252 const std::vector<favicon_base::FaviconRawBitmapResult>&
249 favicon_bitmap_results); 253 favicon_bitmap_results);
250 254
251 DISALLOW_COPY_AND_ASSIGN(FaviconService); 255 DISALLOW_COPY_AND_ASSIGN(FaviconService);
252 }; 256 };
253 257
254 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_ 258 #endif // CHROME_BROWSER_FAVICON_FAVICON_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_handler_unittest.cc ('k') | chrome/browser/favicon/favicon_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698