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

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

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

Powered by Google App Engine
This is Rietveld 408576698